
Sum
不刷脸皮要刷题
这个作者很懒,什么都没留下…
展开
-
3 sum
注意跳过重复的元素!//时间复杂度: O(n^2)public class Solution { public List> threeSum(int[] num) { List> res = new ArrayList<>(); if(num == null || num.length < 3) return res; Arra转载 2014-11-10 11:27:21 · 303 阅读 · 1 评论 -
4 sum
public class Solution { public List> fourSum(int[] num, int target) { List> res = new ArrayList<>(); if (num == null || num.length < 4) { return res; }转载 2014-11-10 11:54:29 · 266 阅读 · 0 评论 -
Trapping rain water
array的找规律的题public class Solution { public int trap(int[] A) { int sum = 0; int maxInd = -1; int max = -1; //find the highest bars; for (int i = 0; i < A.leng转载 2014-10-04 04:30:22 · 303 阅读 · 0 评论 -
Combination Sum I, II
public class Solution { public List> combinationSum(int[] candidates, int target) { if (candidates == null || candidates.length == 0) { return null; } Arrays.so转载 2014-11-11 23:48:00 · 252 阅读 · 0 评论 -
Sum root to leaf numbers
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path 1->2->3 which represents the number 123. Find the total sum转载 2014-10-09 12:31:17 · 491 阅读 · 0 评论