hash
文章平均质量分 66
小榕流光
这个作者很懒,什么都没留下…
展开
-
[leetcode] 288. Unique Word Abbreviation 解题报告
题目链接:https://leetcode.com/problems/unique-word-abbreviation/An abbreviation of a word follows the form . Below are some examples of word abbreviations:a) it --> it (no原创 2016-03-12 06:13:39 · 1966 阅读 · 0 评论 -
[leetcode] 349. Intersection of Two Arrays 解题报告
题目链接: https://leetcode.com/problems/intersection-of-two-arrays/Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return原创 2016-05-18 14:44:57 · 1698 阅读 · 0 评论 -
[leetcode] 217. Contains Duplicate 解题报告
题目链接:https://leetcode.com/problems/contains-duplicate/Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in原创 2016-01-18 14:54:01 · 624 阅读 · 0 评论 -
[leetcode] 380. Insert Delete GetRandom O(1) 解题报告
题目链接: https://leetcode.com/problems/insert-delete-getrandom-o1/Design a data structure that supports all following operations in average O(1) time.insert(val): Inserts an item val to the原创 2016-08-21 04:43:04 · 3729 阅读 · 0 评论 -
[leetcode] 383. Ransom Note 解题报告
题目链接: https://leetcode.com/problems/ransom-note/ Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will原创 2016-08-29 14:16:21 · 1560 阅读 · 0 评论 -
[leetcode] 389. Find the Difference 解题报告
题目链接: https://leetcode.com/problems/find-the-difference/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原创 2016-08-29 14:10:50 · 3053 阅读 · 0 评论 -
[leetcode] 391. Perfect Rectangle 解题报告
题目链接:https://leetcode.com/problems/perfect-rectangle/Given N axis-aligned rectangles where N > 0, determine if they all together form an exact cover of a rectangular region.Each rectangle is原创 2016-09-09 05:33:29 · 2488 阅读 · 0 评论 -
[leetcode] 350. Intersection of Two Arrays II 解题报告
题目链接: https://leetcode.com/problems/intersection-of-two-arrays-ii/Given two arrays, write a function to compute their intersection.Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], ret原创 2016-05-23 13:21:22 · 2481 阅读 · 1 评论 -
[leetcode] 387. First Unique Character in a String 解题报告
题目链接:https://leetcode.com/problems/first-unique-character-in-a-string/Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examp原创 2016-08-25 02:09:38 · 2617 阅读 · 0 评论 -
[leetcode] 422. Valid Word Square 解题报告
题目链接: https://leetcode.com/problems/valid-word-square/Given a sequence of words, check whether it forms a valid word square.A sequence of words forms a valid word square if the kth row and c原创 2016-12-01 15:05:19 · 1668 阅读 · 0 评论 -
[leetcode] 451. Sort Characters By Frequency 解题报告
题目链接:https://leetcode.com/problems/sort-characters-by-frequency/Given a string, sort it in decreasing order based on the frequency of characters.Example 1:Input:"tree"Output:"eert"Ex原创 2016-11-11 05:40:30 · 4284 阅读 · 0 评论 -
[leetcode] 290. Word Pattern 解题报告
题目链接:https://leetcode.com/problems/word-pattern/Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection betwee原创 2015-12-27 07:05:32 · 767 阅读 · 0 评论 -
[leetcode] 138. Copy List with Random Pointer 解题报告
题目链接:https://leetcode.com/problems/copy-list-with-random-pointer/A linked list is given such that each node contains an additional random pointer which could point to any node in the list or nul原创 2016-01-11 01:12:22 · 801 阅读 · 0 评论 -
[leetcode] 438. Find All Anagrams in a String 解题报告
题目链接:https://leetcode.com/problems/find-all-anagrams-in-a-string/Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase Engl原创 2016-10-26 22:46:39 · 3558 阅读 · 0 评论 -
[leetcode] 219. Contains Duplicate II 解题报告
题目链接:https://leetcode.com/problems/contains-duplicate-ii/Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = num原创 2016-01-18 15:18:36 · 549 阅读 · 0 评论 -
[leetcode] 269. Alien Dictionary 解题报告
题目链接: https://leetcode.com/problems/alien-dictionary/There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words原创 2016-03-25 15:58:39 · 6934 阅读 · 1 评论 -
[leetcode] 379. Design Phone Directory 解题报告
题目链接: https://leetcode.com/problems/design-phone-directory/Design a Phone Directory which supports the following operations:get: Provide a number which is not assigned to anyone.check: C原创 2016-08-25 06:25:05 · 3421 阅读 · 0 评论 -
[leetcode] 340. Longest Substring with At Most K Distinct Characters 解题报告
题目链接: https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/Given a string, find the length of the longest substring T that contains at most k distinct characters.原创 2016-04-03 12:28:01 · 6567 阅读 · 0 评论 -
[leetcode] 159. Longest Substring with At Most Two Distinct Characters 解题报告
题目链接:https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters/Given a string, find the length of the longest substring T that contains at most 2 distinct characters.原创 2016-03-18 13:38:51 · 865 阅读 · 0 评论 -
[leetcode] 30. Substring with Concatenation of All Words 解题报告
题目链接:https://leetcode.com/problems/substring-with-concatenation-of-all-words/You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of原创 2015-12-18 04:40:19 · 1095 阅读 · 0 评论 -
[leetcode] 359. Logger Rate Limiter 解题报告
题目链接: https://leetcode.com/problems/logger-rate-limiter/Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not原创 2016-06-24 13:29:42 · 3649 阅读 · 0 评论 -
[leetcode] 291. Word Pattern II 解题报告
题目链接: https://leetcode.com/problems/word-pattern-ii/Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection be原创 2016-06-24 04:20:47 · 4038 阅读 · 0 评论 -
[leetcode] 336. Palindrome Pairs 解题报告
题目链接: https://leetcode.com/problems/palindrome-pairs/ Given a list of unique words. Find all pairs of distinct indices (i, j) in the given list, so that the concatenation of the two words, i.e. wo...原创 2016-05-18 15:42:05 · 5686 阅读 · 0 评论 -
[leetcode] 187. Repeated DNA Sequences 解题报告
题目链接: https://leetcode.com/problems/repeated-dna-sequences/All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is somet原创 2016-05-05 14:24:48 · 1032 阅读 · 0 评论 -
[leetcode] 347. Top K Frequent Elements 解题报告
题目链接:https://leetcode.com/problems/top-k-frequent-elements/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].原创 2016-05-02 11:47:25 · 2577 阅读 · 0 评论 -
[leetcode] 200. Number of Islands 解题报告
题目链接:https://leetcode.com/problems/number-of-islands/Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connect原创 2016-02-29 07:01:33 · 750 阅读 · 0 评论 -
[leetcode] 49. Group Anagrams 解题报告
题目链接:https://leetcode.com/problems/anagrams/Given an array of strings, group anagrams together.For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return:[ ["ate", "eat","t原创 2016-02-29 05:02:32 · 2287 阅读 · 0 评论 -
[leetcode] 274. H-Index 解题报告
题目链接:https://leetcode.com/problems/h-index/Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.Accordi原创 2016-03-05 07:12:59 · 1656 阅读 · 0 评论 -
[leetcode] 249. Group Shifted Strings 解题报告
题目链接:https://leetcode.com/problems/group-shifted-strings/Given a string, we can "shift" each of its letter to its successive letter, for example: "abc" -> "bcd". We can keep "shifting" which f原创 2016-02-29 05:35:37 · 1568 阅读 · 0 评论 -
[leetcode] 325. Maximum Size Subarray Sum Equals k 解题报告
题目链接:https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0原创 2016-03-06 05:50:30 · 6347 阅读 · 0 评论 -
[leetcode] 245. Shortest Word Distance III 解题报告
题目链接: https://leetcode.com/problems/shortest-word-distance-iii/This is a follow up of Shortest Word Distance. The only difference is now word1 could be the same asword2.Given a list of wor原创 2016-03-13 05:52:36 · 1820 阅读 · 0 评论 -
[leetcode] 244. Shortest Word Distance II 解题报告
题目链接: https://leetcode.com/problems/shortest-word-distance-ii/This is a follow up of Shortest Word Distance. The only difference is now you are given the list of words and your method will be原创 2016-03-14 16:23:49 · 2975 阅读 · 0 评论 -
[leetcode] 170. Two Sum III - Data structure design 解题报告
题目链接:https://leetcode.com/problems/two-sum-iii-data-structure-design/Design and implement a TwoSum class. It should support the following operations: add and find.add - Add the number to an原创 2016-03-12 07:21:32 · 1277 阅读 · 0 评论 -
[leetcode] 246. Strobogrammatic Number 解题报告
题目链接:https://leetcode.com/problems/strobogrammatic-number/A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).Write a function to determ原创 2016-03-11 15:45:11 · 1764 阅读 · 0 评论 -
[leetcode] 299. Bulls and Cows 解题报告
题目链接:https://leetcode.com/problems/bulls-and-cows/You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. E原创 2015-12-28 11:05:25 · 601 阅读 · 0 评论 -
[leetcode] 1. Two Sum 解题报告
题目链接:https://leetcode.com/problems/two-sum/Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two原创 2015-12-26 09:45:24 · 544 阅读 · 0 评论 -
[leetcode] 205. Isomorphic Strings 解题报告
题目链接:https://leetcode.com/problems/isomorphic-strings/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.原创 2016-02-13 17:39:30 · 802 阅读 · 0 评论 -
[leetcode] 454. 4Sum II 解题报告
题目链接:https://leetcode.com/problems/4sum-ii/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原创 2016-11-21 08:54:49 · 2005 阅读 · 2 评论