Hash Table
林下溪源
为学日益,为道日损
展开
-
147. Insertion Sort List
Problem: Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list. With each iteration ...原创 2020-03-20 18:11:53 · 110 阅读 · 0 评论 -
274. H-Index
Problem: 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. According to thedefinition of h-index on Wikip...原创 2020-03-16 16:53:39 · 113 阅读 · 0 评论 -
205. Isomorphic Strings
Problem: Given two stringssandt, determine if they are isomorphic. Two strings are isomorphic if the characters inscan be replaced to gett. All occurrences of a character must be replaced wi...原创 2020-03-16 16:33:17 · 119 阅读 · 0 评论 -
242. Valid Anagram
Problem: Given two stringssandt, write a function to determine iftis an anagram ofs. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2: Input: s = "rat", t = "car" ...原创 2020-03-14 16:48:19 · 96 阅读 · 0 评论 -
204. Count Primes
Problem: Count the number of prime numbers less than a non-negative number,n. Example: Input: 10 Output: 4 Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7. Analysis: ...原创 2020-03-13 16:15:17 · 131 阅读 · 0 评论 -
202. Happy Number
Problem: Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of th...原创 2020-03-11 15:45:23 · 159 阅读 · 0 评论 -
187. Repeated DNA Sequences
Problem: 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 ...原创 2020-03-11 15:08:20 · 138 阅读 · 0 评论 -
166. Fraction to Recurring Decimal
Problem: Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating part in parent...原创 2020-03-11 13:03:16 · 134 阅读 · 0 评论 -
149. Max Points on a Line
Problem: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line. Example 1: Input: [[1,1],[2,2],[3,3]] Output: 3 Explanation: ^ | | o | o | ...原创 2020-03-10 15:40:28 · 115 阅读 · 0 评论 -
138. Copy List with Random Pointer
Problem: A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return adeep copyof the list. The Linked List is repr...原创 2020-03-04 13:34:55 · 147 阅读 · 0 评论 -
136. Single Number
Problem: Given anon-emptyarray of integers, every element appearstwiceexcept for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it...原创 2020-03-03 17:59:56 · 119 阅读 · 0 评论 -
76. Minimum Window Substring
Problem: 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). Example: Input: S = "ADOBECODEBANC", T = "ABC" Output: "BANC"...原创 2020-03-03 17:03:14 · 110 阅读 · 0 评论 -
49. Group Anagrams
Problem Description: Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ] ...原创 2020-02-24 12:05:13 · 104 阅读 · 0 评论