摘要:
1 public class Solution { 2 public int numSquares(int n) { 3 int[] dp = new int[n + 1]; 4 for (int i = 1; i <= n; i++) { 5 dp[i] = i; 6 for (int j = ...
阅读全文
posted @ 2016-07-07 13:11
keepshuatishuati
阅读(135)
推荐(0)
posted @ 2016-07-07 13:01
keepshuatishuati
阅读(146)
推荐(0)
摘要:
This is almost the version of K list iterators.
阅读全文
posted @ 2016-07-07 12:56
keepshuatishuati
阅读(181)
推荐(0)
摘要:
1. Deal with 0 situation : only 0 itself is allowed, it cannot be 04. 2. We have to record the previous value that can be used to extract from previou
阅读全文
posted @ 2016-07-07 12:45
keepshuatishuati
阅读(122)
推荐(0)
摘要:
1 // Java Iterator interface reference: 2 // https://docs.oracle.com/javase/8/docs/api/java/util/Iterator.html 3 class PeekingIterator implements Iter
阅读全文
posted @ 2016-07-06 15:26
keepshuatishuati
阅读(122)
推荐(0)
摘要:
Use level + 1 to avoid traversal two rooms back and forth.
阅读全文
posted @ 2016-07-06 15:17
keepshuatishuati
阅读(131)
推荐(0)
摘要:
Remember: need to check whether has the word in hashset and garantee size is one.
阅读全文
posted @ 2016-07-06 14:33
keepshuatishuati
阅读(126)
推荐(0)
摘要:
This is straight forward solution. 00 D <- D 10 L <- D 11 L <- L 01 D <- D So we need to differentiate 11 = 3 and 10 = 2
阅读全文
posted @ 2016-07-06 14:19
keepshuatishuati
阅读(164)
推荐(0)
摘要:
1 public class Solution { 2 public boolean canWin(String s) { 3 if (s.length() result = new ArrayList(); 7 for (int i = 0; i < s.length() - 1; i++) { 8 if (s.cha...
阅读全文
posted @ 2016-07-06 14:10
keepshuatishuati
阅读(111)
推荐(0)
摘要:
1 public class Solution { 2 public List generatePossibleNextMoves(String s) { 3 List result = new ArrayList(); 4 if (s.length() < 2) { 5 return result; 6 ...
阅读全文
posted @ 2016-07-06 09:39
keepshuatishuati
阅读(207)
推荐(0)