上一页 1 2 3 4 5 6 7 ··· 36 下一页
摘要: Note: For square, the minimum size of topleft and top and left decides the square of the result. 阅读全文
posted @ 2017-09-18 13:14 keepshuatishuati 阅读(88) 评论(0) 推荐(0) 编辑
摘要: class Solution { public boolean validPalindrome(String s) { int start = 0, end = s.length() - 1; boolean found = false; while (start < end) { if (s.charAt(star... 阅读全文
posted @ 2017-09-18 13:07 keepshuatishuati 阅读(90) 评论(0) 推荐(0) 编辑
摘要: class Solution { class Task { public char task; public int numTasks; } public int leastInterval(char[] tasks, int n) { if (tasks.length == 0) { return ... 阅读全文
posted @ 2017-09-18 12:44 keepshuatishuati 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Notes: Edge cases: 1. It does not follow while(it.hasNext()) it.next(). So we need add has next check in next() 2. If index is out of boundary, which 阅读全文
posted @ 2017-09-12 15:32 keepshuatishuati 阅读(115) 评论(0) 推荐(0) 编辑
摘要: class Solution { class Interval { public int start; public int end; public Interval(int x, int y) { start = x; end = y; } } public ... 阅读全文
posted @ 2017-09-12 15:06 keepshuatishuati 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Note: 1. Need check i < s.length() and j < t.length(). 2. Only make i-- when s.length() < t.length() since it could be replacement. No need for shift 阅读全文
posted @ 2017-09-11 07:46 keepshuatishuati 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Note: 1. If it does not belong any sequences : append.getOrDefault(num, 0) == 0, create a new sequence. It requires num + 1 and num + 2 count > 0. 2. 阅读全文
posted @ 2017-09-10 14:42 keepshuatishuati 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Note: k different could be [1, k+1] are in wiggle sort order. Then there are k different numbers. But in this case, the last difference definitely wil 阅读全文
posted @ 2017-09-10 13:38 keepshuatishuati 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Note: Basic idea could be same as Kth smallest number in sorted matrix. But this could be different since all the numbers fall in [1, m*n + 1] range. 阅读全文
posted @ 2017-09-10 13:18 keepshuatishuati 阅读(637) 评论(0) 推荐(0) 编辑
摘要: class Solution { private final String[] map = {"", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"}; public List letterCombinations(String digits) { List result = new Arr... 阅读全文
posted @ 2017-09-10 06:32 keepshuatishuati 阅读(127) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 36 下一页