上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 36 下一页
摘要: class Solution { public String predictPartyVictory(String senate) { Queue radiant = new LinkedList(); Queue dire = new LinkedList(); for (int i = 0; i dire.size() ? "Radi... 阅读全文
posted @ 2017-08-25 08:16 keepshuatishuati 阅读(164) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int romanToInt(String s) { int result = 0; for (int i = 0; i < s.length(); i++) { switch(s.charAt(i)) { case 'M': ... 阅读全文
posted @ 2017-08-23 15:40 keepshuatishuati 阅读(93) 评论(0) 推荐(0) 编辑
摘要: LOTS of EDGE CASES: 1. Root path, when we return, it needs to be checked. 2. When we meet "..", we shall check whether it is root path or not, but do 阅读全文
posted @ 2017-08-23 15:26 keepshuatishuati 阅读(100) 评论(0) 推荐(0) 编辑
摘要: Nlog(N) could be get the sum for each steps and binary search of it. 阅读全文
posted @ 2017-08-23 15:04 keepshuatishuati 阅读(109) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int findKthLargest(int[] nums, int k) { if (nums.length == 0) { return 0; } return findKth(nums, 0, nums.length - 1, nums.length - k); ... 阅读全文
posted @ 2017-08-23 15:04 keepshuatishuati 阅读(91) 评论(0) 推荐(0) 编辑
摘要: Since the input is ordered and not overlapped intervals. It is OK to have this kind of simply implementation. 阅读全文
posted @ 2017-08-23 14:17 keepshuatishuati 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 1. Remember to add it again after counting since there are still remaining information in cache. 阅读全文
posted @ 2017-08-23 13:48 keepshuatishuati 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 1. Need check whether each loop of 1000 is 0 or not. Otherwise, it will introduce extra "thousands" words. 2. Each loop needs to count the how many th 阅读全文
posted @ 2017-08-23 13:38 keepshuatishuati 阅读(125) 评论(0) 推荐(0) 编辑
摘要: Constant space solution that counting zeros: Nice Solution: 阅读全文
posted @ 2017-08-22 15:31 keepshuatishuati 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 1. Create node when the neighbor is not found. 阅读全文
posted @ 2017-08-22 14:45 keepshuatishuati 阅读(85) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 36 下一页