JasonChang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 18 下一页

2013年11月19日

摘要: 1 public class Solution { 2 public ArrayList> permute(int[] num) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int len = num.length; 6 ArrayList> result = new ArrayList>(); 7 ... 阅读全文
posted @ 2013-11-19 12:09 JasonChang 阅读(211) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public int minPathSum(int[][] grid) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int m = grid.length; 6 int n = grid[0].length; 7 int[][] r... 阅读全文
posted @ 2013-11-19 12:03 JasonChang 阅读(246) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public int maxSubArray(int[] A) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int result = Integer.MIN_VALUE; 6 int curSum = 0; 7 for(int i ... 阅读全文
posted @ 2013-11-19 05:42 JasonChang 阅读(171) 评论(0) 推荐(0) 编辑

摘要: special牛顿迭代法 1 public class Solution { 2 public int sqrt(int x) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 if(x 0.0001){11 last = cur;12 cur = (cur + x / cur... 阅读全文
posted @ 2013-11-19 03:53 JasonChang 阅读(179) 评论(0) 推荐(0) 编辑

摘要: all the possible 1 public class Solution { 2 public String simplifyPath(String path) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 Stack mystack = new Stack(); 6 char[] mystring... 阅读全文
posted @ 2013-11-19 03:08 JasonChang 阅读(173) 评论(0) 推荐(0) 编辑

摘要: binary search 1 public class Solution { 2 public int[] searchRange(int[] A, int target) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int[] result = new int[2]; 6 if(A == null){... 阅读全文
posted @ 2013-11-19 02:35 JasonChang 阅读(336) 评论(0) 推荐(0) 编辑

2013年11月18日

摘要: 1 public class Solution { 2 public int minDistance(String word1, String word2) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int m = word1.length(), n = word2.length(); 6 int[]... 阅读全文
posted @ 2013-11-18 18:15 JasonChang 阅读(168) 评论(0) 推荐(0) 编辑

摘要: public class Solution { public void setZeroes(int[][] matrix) { // IMPORTANT: Please reset any member data you declared, as // the same Solution instance will be reused for each test case. if(matrix == null || matrix.length == 0) return; boolean column = fal... 阅读全文
posted @ 2013-11-18 18:05 JasonChang 阅读(148) 评论(0) 推荐(0) 编辑

摘要: DFS 1 public class Solution { 2 public boolean exist(char[][] board, String word) { 3 if(word == null || word.length() done = new HashSet(); 6 7 for(int i = 0; i done){17 if(row = board.length || column >= board[0].length)18 return false;19 ... 阅读全文
posted @ 2013-11-18 17:27 JasonChang 阅读(189) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public ListNode deleteDuplicates(ListNode head) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 if(head == null || head.next == null) 6 return hea... 阅读全文
posted @ 2013-11-18 16:54 JasonChang 阅读(195) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 18 下一页