LeetCode 76. Minimum Window Substring(java)

Given a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example, S = "AD...

2018-02-12 11:41:53

阅读数:33

评论数:0

LeetCode 3. Longest Substring Without Repeating Characters(java)

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc&qu...

2018-02-12 02:08:43

阅读数:37

评论数:0

532. K-diff Pairs in an Array(java)

Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an int...

2018-02-04 09:07:33

阅读数:39

评论数:0

LeetCode 205. Isomorphic Strings(java)

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrence...

2018-02-03 14:12:03

阅读数:28

评论数:0

递归优化小技巧:用hashmap或者数组来预存sub-result以加快速度

技巧如题,先用hashmap或者数组来保存某些已经算好的,之后可能会重复用到的子问题的答案,这样在每次递归之前先判断,如果是存在在map里的,就直接取value返回即可。可以大大提高递归的效率。 例一:LeetCode 140. Word Break II Given a non-empty ...

2018-01-21 04:09:11

阅读数:71

评论数:0

LeetCode 128. Longest Consecutive Sequence(java)

Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 200, 1, 3, 2], The lo...

2018-01-15 04:46:56

阅读数:42

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭