JasonChang

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

2013年11月20日

摘要: 1 public class Solution { 2 public void solveSudoku(char[][] board) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 solveSudokuRecursive(board); 6 } 7 private boolean solveSudoku... 阅读全文
posted @ 2013-11-20 10:23 JasonChang 阅读(200) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public static ArrayList restoreIpAddresses(String s) { 3 // Start typing your Java solution below 4 // DO NOT write main() function 5 ArrayList result = new ArrayList(); 6 if (s == null || s.length() == 0) { 7 return result... 阅读全文
posted @ 2013-11-20 10:11 JasonChang 阅读(200) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public String strStr(String haystack, String needle) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int needleLen = needle.length(); 6 int haystackLe... 阅读全文
posted @ 2013-11-20 09:58 JasonChang 阅读(193) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public ArrayList insert(ArrayList intervals, Interval newInterval) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 ArrayList result = new ArrayList(); 6 ... 阅读全文
posted @ 2013-11-20 09:55 JasonChang 阅读(139) 评论(0) 推荐(0) 编辑

摘要: threaded binary tree 1 public class Solution { 2 public void recoverTree(TreeNode root) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 TreeNode f1 = null, f2 = null; 6 TreeNode ... 阅读全文
posted @ 2013-11-20 09:46 JasonChang 阅读(198) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public int firstMissingPositive(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 len = A.length; 6 for (int i = 0; i 0 && A[i] != i + 1 &... 阅读全文
posted @ 2013-11-20 09:29 JasonChang 阅读(175) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public ListNode rotateRight(ListNode head, int n) { 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 || n == 0){ 6 return head; 7 ... 阅读全文
posted @ 2013-11-20 09:15 JasonChang 阅读(120) 评论(0) 推荐(0) 编辑

摘要: 1 public class Solution { 2 public String longestPalindrome(String s) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be reused for each test case. 5 int n = s.length(); 6 if (n == 0) return ""; 7 Strin... 阅读全文
posted @ 2013-11-20 08:50 JasonChang 阅读(205) 评论(0) 推荐(0) 编辑

摘要: similar with 3Sum. O(n3) 1 public class Solution { 2 public ArrayList> fourSum(int[] num, 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 Arrays.sort(num); 6 HashSet> ... 阅读全文
posted @ 2013-11-20 08:05 JasonChang 阅读(179) 评论(0) 推荐(0) 编辑

2013年11月19日

摘要: 1 public class Solution { 2 public ArrayList anagrams(String[] strs) { 3 // Start typing your Java solution below 4 // DO NOT write main() function 5 int len = strs.length; 6 ArrayList result = new ArrayList(); 7 Map> sorted = new HashMap>(); 8 9... 阅读全文
posted @ 2013-11-19 16:58 JasonChang 阅读(160) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 18 下一页