JasonChang

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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) 编辑

摘要: dynamic programming 1 public class Solution { 2 public int maximalRectangle(char[][] matrix) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 if(matrix == null||matrix.length == 0) 6 ... 阅读全文
posted @ 2013-11-18 16:32 JasonChang 阅读(182) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public ListNode partition(ListNode head, 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 ListNode fakeLeftHead = new ListNode(0); 6 ListNode fa... 阅读全文
posted @ 2013-11-18 15:54 JasonChang 阅读(163) 评论(0) 推荐(0) 编辑