上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 36 下一页
摘要: It's like the packing problem. Brute force: 阅读全文
posted @ 2017-08-30 14:28 keepshuatishuati 阅读(83) 评论(0) 推荐(0) 编辑
摘要: We can avoid more duplicate work by check [0, haystack - needle + 1] length. Need to revisit KMP 阅读全文
posted @ 2017-08-30 14:14 keepshuatishuati 阅读(74) 评论(0) 推荐(0) 编辑
摘要: Follow up questions, what if dup allows: 1. Map<Value, Queue<Indexes>> if it looks like a queue first in first out. 2. Map<Value, Map<Index, Indexes>> 阅读全文
posted @ 2017-08-30 13:55 keepshuatishuati 阅读(77) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int longestConsecutive(int[] nums) { if (nums.length set = new HashSet(); for (int num : nums) { set.add(num); } i... 阅读全文
posted @ 2017-08-30 13:23 keepshuatishuati 阅读(90) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ class Solution { pub... 阅读全文
posted @ 2017-08-28 13:17 keepshuatishuati 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Although it is a simple question, it must be carefully treated. 阅读全文
posted @ 2017-08-28 13:11 keepshuatishuati 阅读(85) 评论(0) 推荐(0) 编辑
摘要: class Solution { public List> subsetsWithDup(int[] nums) { List> result = new ArrayList(); result.add(new ArrayList()); Arrays.sort(nums); int count = 0; ... 阅读全文
posted @ 2017-08-28 13:00 keepshuatishuati 阅读(94) 评论(0) 推荐(0) 编辑
摘要: class Trie { private TrieNode root; class TrieNode { TrieNode[] children = new TrieNode[26]; boolean isWord; } /** Initialize your data structure here. */ public ... 阅读全文
posted @ 2017-08-28 12:24 keepshuatishuati 阅读(94) 评论(0) 推荐(0) 编辑
摘要: class Solution { public int search(int[] nums, int target) { if (nums.length == 0) { return -1; } int start = 0; int end = nums.length - 1; ... 阅读全文
posted @ 2017-08-28 12:12 keepshuatishuati 阅读(135) 评论(0) 推荐(0) 编辑
摘要: class LRUCache { private int _capacity; private int _currentSize; private Map nodeMap; private Node head; private Node tail; class Node { public int key; publi... 阅读全文
posted @ 2017-08-28 11:50 keepshuatishuati 阅读(96) 评论(0) 推荐(0) 编辑
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 36 下一页