摘要:
Note: MANY DETAILS ARE MISSED: 1. If less than 3, return as many as it. So it could be NPE when queue.poll().getKey() 2. Use alphabetical order if tim
阅读全文
posted @ 2017-09-07 16:05
keepshuatishuati
阅读(828)
推荐(0)
摘要:
Note: 1. Need check whether the node is the last node or not. 2. Need add a counter for counting how many branches it has. UnionFind
阅读全文
posted @ 2017-09-07 14:49
keepshuatishuati
阅读(124)
推荐(0)
摘要:
Note: Need to skipp the 0 element update room but cannot skip BFS from that point
阅读全文
posted @ 2017-09-07 13:49
keepshuatishuati
阅读(121)
推荐(0)
摘要:
class Solution { public int[][] multiply(int[][] A, int[][] B) { if (A.length == 0 || A[0].length == 0 || B.length == 0 || B[0].length == 0 || A[0].length != B.length) { retur...
阅读全文
posted @ 2017-09-07 13:25
keepshuatishuati
阅读(168)
推荐(0)
摘要:
Notes: Lots of places need to be remember: Edge cases: 1. Only one word, still need to be calculated as it represents. 2. All unique chars that not be
阅读全文
posted @ 2017-09-05 17:15
keepshuatishuati
阅读(125)
推荐(0)
摘要:
class Solution { public int minCostII(int[][] costs) { if (costs.length == 0) { return 0; } int prevMin = 0; int prevSecMin = 0; int p...
阅读全文
posted @ 2017-09-05 16:12
keepshuatishuati
阅读(108)
推荐(0)
摘要:
/* The read4 API is defined in the parent class Reader4. int read4(char[] buf); */ public class Solution extends Reader4 { /** * @param buf Destination buffer * @param n Maximu...
阅读全文
posted @ 2017-09-05 14:02
keepshuatishuati
阅读(89)
推荐(0)
摘要:
class Solution { public List fullJustify(String[] words, int maxWidth) { List result = new ArrayList(); if (words.length == 0) { return result; } int i...
阅读全文
posted @ 2017-09-05 12:38
keepshuatishuati
阅读(103)
推荐(0)
摘要:
Notes: 1. Use long since it will overflow. 2 When c != '*', it is normal decode ways. Thus current ways is c could be single digits (c > 0 ?) * prev o
阅读全文
posted @ 2017-09-04 16:36
keepshuatishuati
阅读(152)
推荐(0)
摘要:
/** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode(int x) { val = x; } * } */ class Solution { public ListNode reverseKGr...
阅读全文
posted @ 2017-09-04 15:27
keepshuatishuati
阅读(114)
推荐(0)