
哈希
文章平均质量分 67
sscssz
这个作者很懒,什么都没留下…
展开
-
3. Longest Substring Without Repeating Characters【M】【28】【leetcode】
Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For原创 2016-03-31 21:49:51 · 362 阅读 · 0 评论 -
【leetcode】454. 4Sum II【M】
Given four lists A, B, C, D of integer values, compute how many tuples (i, j, k, l) there are such that A[i] + B[j] + C[k] + D[l] is zero.To make problem a bit easier, all A, B, C, D have same l原创 2016-11-22 13:11:12 · 1160 阅读 · 0 评论 -
【leetcode】447. Number of Boomerangs【E】
Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between iand j equals the distance between i and k (the order of t原创 2016-11-07 23:32:20 · 2391 阅读 · 0 评论 -
【leetcode】387. First Unique Character in a String【E】
Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.Note:原创 2016-08-23 12:18:25 · 409 阅读 · 0 评论 -
【leetcode】398. Random Pick Index【M】
Given an array of integers with possible duplicates, randomly output the index of a given target number. You can assume that the given target number must exist in the array.Note:The array size c原创 2016-09-13 09:52:02 · 1327 阅读 · 0 评论 -
【leetcode】389. Find the Difference【E】
Given two strings s and t which consist of only lowercase letters.String t is generated by random shuffling string s and then add one more letter at a random position.Find the letter that was原创 2016-08-31 09:56:33 · 628 阅读 · 0 评论 -
187. Repeated DNA Sequences 【M】【30】
All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.Wri原创 2016-05-09 16:44:01 · 551 阅读 · 0 评论 -
347. Top K Frequent Elements【M】【VIP】【字典排序】
Given a non-empty array of integers, return the k most frequent elements.For example,Given [1,1,1,2,2,3] and k = 2, return [1,2].Note: You may assume k is always valid, 1 ≤ k ≤ number原创 2016-05-09 14:58:23 · 477 阅读 · 0 评论 -
211. Add and Search Word - Data structure design【M】【91】
Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regular expression string containing only let原创 2016-05-27 20:37:17 · 379 阅读 · 0 评论 -
204. Count Primes【E】【40】【150题纪念!】
Description:Count the number of prime numbers less than a non-negative number, n.Credits:Special thanks to @mithmatt for adding this problem and creating all test cases.Hint:Let's原创 2016-04-18 13:40:27 · 330 阅读 · 0 评论 -
49. Group Anagrams 【M】【47】
Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","tea"], ["nat","tan"], ["bat"]]Note:原创 2016-04-29 17:30:43 · 396 阅读 · 0 评论 -
1. Two Sum【E】【59+25】【leetcode】
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:Given nums =原创 2016-03-21 13:09:46 · 547 阅读 · 0 评论 -
【LeetCode】451. Sort Characters By Frequency【M】【68】
Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Explanation:'e' appears twice while 'r' and 't' both appear once.So 'e原创 2017-02-19 10:30:50 · 459 阅读 · 0 评论