# | Title | Solution | Time | Space | Difficulty | Note |
347 | O(n) | O(n) | Medium | Quick Select, Heap, Bucket Sort | ||
3 | O(n) | O(min(n,m)) | Medium | Hash Table | ||
454 | O(n^2) | O(n^2) | Medium | Hash Table | ||
36 | O(9^2) | O(9) | Medium | Hash Table | ||
554 | O(n) | O(m) | Medium | Hash Table, Array | ||
49 | O(n*glog(g)) | O(n) | Medium | Hash Table | ||
380 | O(1) | O(n) | Medium | Design | ||
350 | O(m+n) | O(1) | Easy | Two Pointers, Hash, Binary Search | ||
771 | O(m+n) | O(n) | Easy | Hash Table | ||
219 | O(n) | O(n) | Easy | Hash Table | ||
387 | O(n) | O(n) | Easy | Hash Table | ||
599 | O((m+n)*l) | O(m*l) | Easy | Hash Table | ||
205 | O(n) | O(n) | Easy | Hash Table | ||
1 | O(n) | O(n) | Easy | Hash Table | ||
202 | O(log n) | O(1) | Easy | Hash Table, Two Pointers | ||
136 | O(n) | O(1) | Easy | Bit Manipulation, Hash Table | ||
217 | O(n) | O(n) | Easy | Hash Table | ||
706 | O(1) | O(n) | Easy | Design | ||
705 | O(1) | O(n) | Easy | Design | ||
349 | O(m+n) | O(min(m,n)) | Easy | Two Pointers, Hash, Binary Search | ||
170 | O(n) | O(n) | Easy | Premium, Hash Table | ||
249 | O(n log(n)) | O(n) | Medium | Premium, Hash Table | ||
359 | 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.