Given an integer array nums with all positive numbers and no duplicates, find the number o ...
DP. boolean d i j : For the first i items, can we fill a backpack of size j true or false. d i j d i j j gt A i amp amp d i j A i . d true We can use D array to perform the DP. d j d j d j A i . NOTE ...
2015-02-03 09:14 2 3299 推荐指数:
Given an integer array nums with all positive numbers and no duplicates, find the number o ...
第二遍做法:跟 Remove Duplicate Letters 和 Create Maximum Number很像 维护一个stack,每次把当前char加进去,直到加到A.leng ...
在计算最终的 index 时需要动态计算某个数的相对大小。我们可通过两重循环得出到某个索引处值的相对大小。 正确 以4,1,2为例,4为第3大数,1为剩余序列第1大数,2 ...
题目 三数之和 给出一个有n个整数的数组S,在S中找到三个整数a, b, c,找到所有使得a + b + c = 0的三元组。 样例 如S = {-1 0 ...
1、A+B问题 给出两个整数a和b, 求他们的和, 但不能使用 + 等数学运算符 思路:作异或得到未进位和,作与并向左移1位得到进位,随后再重复操作俩结果,直到进位为0,适合用递归 ...
Given an interval list which are flying and landing time of the flight. How many airplanes are on ...
Number of Islands II Given a n,m which means the row and column of the 2D matrix and an array of pa ...
最近开始刷lintcode,记录下自己的答案,数字即为lintcode题目号,语言为python3,坚持日拱一卒吧。。。 (一). 回文字符窜问题(Palindrome problem) 627. Longest Palindrome 给出一个包含大小写字母的字符串。求出由这些字母构成 ...