#

Title

Solution

Time

Space

Difficulty

Note

347

Top K Frequent Elements

Python

O(n)

O(n)

Medium

Quick Select, Heap, Bucket Sort

3

Longest Substring Without Repeating Characters

Python

O(n)

O(min(n,m))

Medium

Hash Table

454

4Sum II

Python

O(n^2)

O(n^2)

Medium

Hash Table

36

Valid Sudoku

Python

O(9^2)

O(9)

Medium

Hash Table

554

Brick Wall

Python

O(n)

O(m)

Medium

Hash Table, Array

49

Group Anagrams

Python

O(n*glog(g))

O(n)

Medium

Hash Table

380

Insert Delete GetRandom O(1)

Python

O(1)

O(n)

Medium

Design

350

Intersection of Two Arrays II

Python

O(m+n)

O(1)

Easy

Two Pointers, Hash, Binary Search

771

Jewels and Stones

Python

O(m+n)

O(n)

Easy

Hash Table

219

Contains Duplicate II

Python

O(n)

O(n)

Easy

Hash Table

387

First Unique Character in a String

Python

O(n)

O(n)

Easy

Hash Table

599

Minimum Index Sum of Two Lists

Python

O((m+n)*l)

O(m*l)

Easy

Hash Table

205

Isomorphic Strings

Python

O(n)

O(n)

Easy

Hash Table

1

Two Sum

Python

O(n)

O(n)

Easy

Hash Table

202

Happy Number

Python

O(log n)

O(1)

Easy

Hash Table, Two Pointers

136

Single Number

Python

O(n)

O(1)

Easy

Bit Manipulation, Hash Table

217

Contains Duplicate

Python

O(n)

O(n)

Easy

Hash Table

706

Design HashMap

Python

O(1)

O(n)

Easy

Design

705

Design HashSet

Python

O(1)

O(n)

Easy

Design

349

Intersection of Two Arrays

Python

O(m+n)

O(min(m,n))

Easy

Two Pointers, Hash, Binary Search

170

Two Sum III - Data structure design

Python

O(n)

O(n)

Easy

Premium, Hash Table

249

Group Shifted Strings

Python

O(n log(n))

O(n)

Medium

Premium, Hash Table

359

Logger Rate Limiter

Python

O(1), amortized

O(k)

Easy

Premium, Deque, Design

#170) Design a data structure that accepts a stream of integers and checks if it has a pair of integers that sum up to a particular value. Implement the TwoSum class: TwoSum() Initializes the TwoSum object, with an empty array initially. void add(int number) Adds number to the data structure. boolean find(int value) Returns true if there exists any pair of numbers whose sum is equal to value, otherwise, it returns false.

#249) We can shift a string by shifting each of its letters to its successive letter. For example, "abc" can be shifted to be "bcd". We can keep shifting the string to form a sequence. For example, we can keep shifting "abc" to form the sequence: "abc" -> "bcd" -> ... -> "xyz". Given an array of strings strings, group all strings[i] that belong to the same shifting sequence. You may return the answer in any order.

#359) Design a logger system that receives a stream of messages along with their timestamps. Each unique message should only be printed at most every 10 seconds (i.e. a message printed at timestamp t will prevent other identical messages from being printed until timestamp t + 10). All messages will come in chronological order. Several messages may arrive at the same timestamp. Implement the Logger class: Logger() Initializes the logger object. bool shouldPrintMessage(int timestamp, string message) Returns true if the message should be printed in the given timestamp, otherwise returns false.