随笔分类 -  dp 2

354. Russian Doll Envelopes
摘要:lamda expression and n^2 longest increasing subsequence int[] = width, height lamda expression and binary search in longest increasing subsequence 阅读全文

posted @ 2018-11-08 01:40 猪猪🐷

674 Longest Continuous Increasing Subsequence
摘要:Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). Example 1: Input: [1,3,5,4,7] Output: 3 Explanation: The longest continuous increasing s... 阅读全文

posted @ 2018-11-06 07:33 猪猪🐷

300. Longest Increasing Subsequence
摘要:Smallest larger than 4 is 5 1 3 5 7 4 1 3 4 7 这道题,遇到新的数, 如果新的数比队尾的数还要大, 那么就把新的数加到队尾, 如果新的数等于或者小于队尾的数, 那么就在队列中找到比第一个比新的数大的最小的数, smallest larger , 这里用到了 阅读全文

posted @ 2018-11-06 07:32 猪猪🐷

646. Maximum Length of Pair Chain
摘要:646. Maximum Length of Pair Chain You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can follow another pair (a,... 阅读全文

posted @ 2018-09-20 18:08 猪猪🐷

152. Maximum Product Subarray
摘要:152. Maximum Product Subarray Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: Input: [2,3,-2,4] ... 阅读全文

posted @ 2018-09-20 18:06 猪猪🐷

导航