摘要:
Tips: Tried to use a private method to simplize the code. But found that object is passed by reference. So even if you have ListNode as l, and l = l.n
阅读全文
posted @ 2017-07-25 13:25
keepshuatishuati
阅读(69)
推荐(0)
摘要:
FOLLOW UPS: What if the input is coming streaming and you cannot even store the window? But you can store the checked String. I purposed this algorith
阅读全文
posted @ 2017-07-23 08:21
keepshuatishuati
阅读(78)
推荐(0)
摘要:
1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 ...
阅读全文
posted @ 2017-07-23 07:44
keepshuatishuati
阅读(95)
推荐(0)
摘要:
Tips : 1. Need to new array list since it is passed by reference. All the values will be cleaned up the original data is used. 2. For iteraive, no nee
阅读全文
posted @ 2017-07-23 07:22
keepshuatishuati
阅读(131)
推荐(0)
摘要:
1 /** 2 * Definition for an interval. 3 * public class Interval { 4 * int start; 5 * int end; 6 * Interval() { start = 0; end = 0; } 7 * Interval(int s, int e) { start = ...
阅读全文
posted @ 2016-08-08 13:03
keepshuatishuati
阅读(112)
推荐(0)
摘要:
1 public class Solution { 2 public String alienOrder(String[] words) { 3 if (words.length == 0) { 4 return ""; 5 } 6 StringBuilder result = new StringBui...
阅读全文
posted @ 2016-08-07 13:44
keepshuatishuati
阅读(156)
推荐(0)
摘要:
1 public class Solution { 2 public int kthSmallest(int[][] matrix, int k) { 3 if (matrix.length == 0 || matrix[0].length == 0 || k queue = new PriorityQueue(); 7 for (int i =...
阅读全文
posted @ 2016-08-07 08:50
keepshuatishuati
阅读(183)
推荐(0)
摘要:
1 public class PhoneDirectory { 2 private boolean[] nums; 3 private Queue queue; 4 /** Initialize your data structure here 5 @param maxNumbers - The maximum numbers that can ...
阅读全文
posted @ 2016-08-07 08:42
keepshuatishuati
阅读(132)
推荐(0)
摘要:
1 /** 2 * Definition for a binary tree node. 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeNode(int x) { val = x; } 8 * } 9 ...
阅读全文
posted @ 2016-07-31 18:27
keepshuatishuati
阅读(227)
推荐(0)
摘要:
1 public class Solution { 2 public int[][] multiply(int[][] A, int[][] B) { 3 int aM = A.length, aN = A[0].length, bN = B[0].length; 4 int [][] result = new int[aM][bN]; 5 ...
阅读全文
posted @ 2016-07-27 05:54
keepshuatishuati
阅读(158)
推荐(0)