上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页
摘要: class Solution { public int firstMissingPositive(int[] nums) { int i=0; while(i0&&nums[i]<=nums.length&&nums[i]!=nums[nums[i]-1]) { int tmp=nums[i]; ... 阅读全文
posted @ 2017-09-24 13:03 Weiyu Wang 阅读(106) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> combinationSum2(int[] candidates, int target) { List> ret=new ArrayList>(); Arrays.sort(candidates); boolean[] used=new boolean[candidates.le... 阅读全文
posted @ 2017-09-24 04:22 Weiyu Wang 阅读(89) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public List> combinationSum(int[] candidates, int target) { List> ret=new ArrayList>(); Arrays.sort(candidates); generateCombination(new ArrayList(... 阅读全文
posted @ 2017-09-24 02:39 Weiyu Wang 阅读(117) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void solveSudoku(char[][] board) { boolean[][][] used=new boolean[3][9][9]; for(int i=0;i<9;i++) for(int j=0;j<9;j++) if(board[... 阅读全文
posted @ 2017-09-23 14:34 Weiyu Wang 阅读(93) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public boolean isValidSudoku(char[][] board) { boolean[][][] used=new boolean[3][9][9]; for(int i=0;i<9;i++) for(int j=0;j<9;j++) ... 阅读全文
posted @ 2017-09-23 13:43 Weiyu Wang 阅读(122) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int[] searchRange(int[] nums, int target) { return new int[]{binarySearch(nums,target,true),binarySearch(nums,target,false)}; } private int binarySe... 阅读全文
posted @ 2017-09-23 13:23 Weiyu Wang 阅读(124) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public int search(int[] nums, int target) { int l=0; int r=nums.length-1; while(l<r) { int m=l+(r-l)/2; if(nums[m]=... 阅读全文
posted @ 2017-09-23 13:08 Weiyu Wang 阅读(117) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int longestValidParentheses(String s) { int left=-1; Stack stack=new Stack(); int ret=0; for(int i=0;i<s.length();i++) { ... 阅读全文
posted @ 2017-09-23 11:50 Weiyu Wang 阅读(127) 评论(0) 推荐(0) 编辑
摘要: class Solution { public void nextPermutation(int[] nums) { int i=nums.length-1; while(i>0&&nums[i-1]>=nums[i])i--; if(i==0) { Arrays.sort(nums); ... 阅读全文
posted @ 2017-09-23 07:33 Weiyu Wang 阅读(117) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List findSubstring(String s, String[] words) { List ret=new ArrayList(); if(words.length==0||words[0].length()==0||s.length()==0) return ret; ... 阅读全文
posted @ 2017-09-23 07:18 Weiyu Wang 阅读(130) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 22 下一页