28 Hash Table or Set

HashMap 有两种处理collision的方式,一种叫open, 如果位置被占了,就顺着找隔壁的;另一种叫close,如果位置被占了,就拉一条链表加进去。在resize的时候,记得重新把所有元素hash一边。

L129 Rehashing

L128 Hash Function

205 Isomorphic Strings

290 Word Pattern

L389 Valid Sudoku (36)

242 Valid Anagram

1 Two Sum(L56)

532 K-diff Pairs in an Array

L138 Subarray Sum -- hash

L405 Submatrix Sum --L138进化版

314 Binary Tree Vertical Order Traversal

987 Vertical Order Traversal of a Binary Tree -- 解法同上

Amicable Pair less than n-- snapchat

49 Group Anagrams

451 Sort Characters By Frequency

128 Longest Consecutive Sequence(L124)

249 Group Shifted Strings

383 Ransom Note

358 Rearrange String k Distance Apart

767 Reorganize String == Rearrange chars in string such that no 2 adjacent are the same 是上一题 358 Rearrange String k distance apart 的简化版

525 Contiguous Array -- cc189 17.5 Letters and Numbers

187 Repeated DNA Sequences -- can use rolling hash as well

217 Contains Duplicate

219 Contains Duplicate II

220 Contains Duplicate III -- TreeMap or bucket sort

349 Intersection of Two Arrays

350 Intersection of Two Arrays II

599 Minimum Index Sum of Two Lists

387 First Unique Character in a String

771 Jewels and Stones

819 Most Common Word

274 H-Index -- 桶排序

Pramp - Getting a Different Number -- S:O(1)的解法好熟,但忘了哪里见过。有空补链接。

1640 Check Array Formation Through Concatenation

1657 Determine if Two Strings Are Close

709 To Lower Case

1165 Single-Row Keyboard

575 Distribute Candies

1461 Check If a String Contains All Binary Codes of Size K

1133 Largest Unique Number

1394 Find Lucky Integer in an Array

1198 Find Smallest Common Element in All Rows

389 Find the Difference

760 Find Anagram Mappings

2395 Find Subarrays With Equal Sum

other related:

37 Sudoku solver -- search

Last updated