上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页
摘要: class Solution { public List> combine(int n, int k) { List> res=new ArrayList>(); combine(n, k, new ArrayList(), res); return res; } private void combine(int num, ... 阅读全文
posted @ 2017-09-27 04:57 Weiyu Wang 阅读(136) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String minWindow(String s, String t) { boolean[] chs=new boolean[128]; int[] cnt=new int[128]; for(int i=0;i0&&r0) count--; ... 阅读全文
posted @ 2017-09-27 04:38 Weiyu Wang 阅读(122) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public void sortColors(int[] nums) { int lo=0; int hi=nums.length-1; int idx=0; while(idx<=hi) { if(nums[idx]==0) ... 阅读全文
posted @ 2017-09-26 12:01 Weiyu Wang 阅读(93) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public boolean searchMatrix(int[][] matrix, int target) { if(matrix.length==0||matrix[0].length==0) return false; int m=matrix.length; ... 阅读全文
posted @ 2017-09-26 11:43 Weiyu Wang 阅读(95) 评论(0) 推荐(0) 编辑
摘要: public class Solution { public void setZeroes(int[][] matrix) { if(matrix.length==0||matrix[0].length==0) return; boolean row0=false; for(int i=0;i=0;i--) ... 阅读全文
posted @ 2017-09-26 11:36 Weiyu Wang 阅读(126) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int minDistance(String word1, String word2) { int[][] dp=new int[word1.length()+1][word2.length()+1]; for(int i=0;i<=word1.length();i++) dp[i][... 阅读全文
posted @ 2017-09-26 10:52 Weiyu Wang 阅读(125) 评论(0) 推荐(0) 编辑
摘要: class Solution { public String simplifyPath(String path) { Stack stack=new Stack(); String[] strs=path.split("\\/"); for(int i=0;i<strs.length;i++) { i... 阅读全文
posted @ 2017-09-26 06:27 Weiyu Wang 阅读(112) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List fullJustify(String[] words, int maxWidth) { List res=new ArrayList(); int idx=0; while(idx0) { sb.... 阅读全文
posted @ 2017-09-26 06:19 Weiyu Wang 阅读(131) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean isNumber(String s) { s=s.trim(); int idx=s.indexOf('e'); if(idx>0) return isNum(s.substring(0,idx), false)&&isNum(s.substring(i... 阅读全文
posted @ 2017-09-26 05:32 Weiyu Wang 阅读(141) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int minPathSum(int[][] grid) { for(int i=0;i0&&j>0) grid[i][j]+=Math.min(grid[i-1][j],grid[i][j-1]); else if(j>0) ... 阅读全文
posted @ 2017-09-26 05:11 Weiyu Wang 阅读(101) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 22 下一页