Algorithm/System Design Practice
Supported Language
Miscellaneous
easy
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Binary Watch | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Roman Digits | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
|
Valid Anagram | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Medium
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Pouring Water | Solution Test |
||||||
RankTeams | Solution Test |
Hard
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Best Time to Buy and Sell Stock(I, II, III, IV, Cooldown, Fee) | Solution Test |
Solution Test |
Solution Test |
||||
List Of List Iterator | Solution Test |
||||||
Iterable Iterator | Solution Test |
Array
easy
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Rotate Array | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
||
Reverse Vowels of a String | Solution Test |
Solution Test |
Solution Test |
||||
Move Zero | Solution Test |
Solution Test |
Medium
Hard
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Remove duplicates int from array | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
||
Print Pattern | Solution Test |
Solution Test |
Solution Test |
||||
Sliding Windows | Solution Test |
Solution Test |
Solution Test |
||||
Minimum Size Subarray Sum | Solution Test |
||||||
Continuous Subarray Sum | Solution Test |
||||||
Subarray Product Less Than K | Solution Test |
Solution Test |
|||||
Longest Palindrome Length | Solution Test |
||||||
Merge Intervals | Solution Test |
||||||
Wiggle Sort | Solution Test |
||||||
Brick Wall | Solution |
||||||
Next Greater Element | Solution Test |
||||||
Search for a Range | Solution Test |
||||||
1-bit and 2-bit Characters | Solution Test |
||||||
Count of Smaller Numbers After Self | Solution Test |
||||||
Insert Interval | Solution Test |
Solution Test |
|||||
Word Search | Solution Test |
||||||
Intersection of Arrays | Solution Test |
Solution Test |
Solution Test |
||||
Longest Consecutive Sequence | Solution Test |
||||||
Largest Number | Solution Test |
||||||
Candies | Solution Test |
||||||
Water | Solution Test |
||||||
Gas Station | Solution Test |
||||||
Implement queue with array | Solution Test |
||||||
Most Population Year | |||||||
Replace Elements with Greatest Element on Right Side | Solution Test |
||||||
Reverse Only Letters | Solution Test |
||||||
Pour Water | Solution Test |
||||||
Find Smallest Letter Greater Than Target | Solution Test |
||||||
Maximum Width Ramp | Solution Test |
||||||
Pancake Sorting | Solution Test |
Matrix
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Minimum steps to G(Facebook) | Solution Test |
||||||
Rotate Image | Solution Test |
Solution Test |
|||||
Spiral Matrix II | Solution Test |
Solution Test |
|||||
Number of Islands | Solution Test |
Solution Test |
|||||
Set Zeroes | Solution Test |
||||||
Search I | Solution Test |
||||||
Search II | Solution Test |
||||||
Mine Sweeper | Solution Test |
Linked List
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Circle | Solution Test |
Solution Test |
|||||
Remove reverse kth element | Solution Test |
||||||
One diff only(Facebook) | Solution Test |
||||||
Swap Pairs | Solution Test |
||||||
Reorder List | Solution Test |
||||||
Odd Even Linked List | Solution Test |
||||||
Reverse Nodes in k-Group | Solution Test |
||||||
Print Immutable Linked List in Reverse | Solution Test |
Stack
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Min Stack(Netflix) | Solution Test |
Solution Test |
Solution Test |
||||
Wiggle Subsequence | Solution Test |
Solution Test |
|||||
Max Chunks To Make Sorted | Solution Test |
||||||
Calculator | Solution Test |
Math
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Add One(Apple) | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
|
Sort by one(GE) | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
|
Reverse Integer | Solution Test |
Solution Test |
|||||
One's Number | Solution |
Solution Test |
|||||
Add Two Numbers | Solution Test |
Solution Test |
|||||
ATOI | Solution Test |
Solution Test |
|||||
Sum(Two Sum, Three Sum, Three Sum Closest, 4 Sum) | Solution Test |
||||||
Ugly Number | Solution Test |
Solution Test |
|||||
Count Numbers with Unique Digits | Solution Test |
||||||
Prime Sum(Facebook) | Solution Test |
||||||
Big Integer(Facebook) | Solution Test |
||||||
Single Number | Solution Test |
||||||
Arranging Coins | Solution Test |
||||||
Perfect Number | Solution Test |
Solution Test |
|||||
Prime Number of Set Bits in Binary Representation | Solution Test |
||||||
Sequential Digits | Solution Test |
Bit Operation
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Power Of Four | Solution Test |
Solution Test |
Solution Test |
Solution Test |
|||
Single Number | Solution Test |
Solution Test |
Solution Test |
Solution Test |
Solution Test |
||
Swap Two Integer | Solution Test |
Solution Test |
Tree
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Binrary Tree Serialization(Apple) | Solution Test |
||||||
Binrary Tree Traversal | Solution Test |
Solution Test ] |
Solution Test |
||||
Minimum Height Trees | Solution Test |
||||||
Longest Consecutive Path | Solution Test |
||||||
Binary Tree Zigzag Level Order Traversal | Solution Test |
||||||
Find Duplicate Subtrees | Solution Test |
||||||
Longest Path(Facebook) | Solution Test |
||||||
Balanced Binrary Tree | Solution Test |
||||||
Add One Row to Tree | Solution Test |
||||||
Construct String from Binary Tree | Solution Test |
||||||
Range Sum of BST | Solution Test |
||||||
Path Sum III | Solution Test |
||||||
Find Largest Value in Each Tree Row | Solution Test |
||||||
Deepest Leaves Sum | Solution Test |
String
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Knuth–Morris–Pratt | Solution Test |
Solution Test |
Solution Test |
Solution Test |
|||
Longest Substring Without Repeating Characters | Solution Test |
||||||
Isomorphic Strings | Solution Test |
Solution Test |
|||||
Reverse Words | Solution Test |
Solution Test |
Solution Test |
||||
Interleave(Facebook) | Solution Test |
||||||
Count cross for reorder array | Solution Test |
||||||
Minimum Time Difference | Solution Test |
||||||
Remove K Digits | Solution Test |
||||||
Minimum Window Substring | Solution Test |
||||||
Z Sort | Solution Test |
Solution Test |
|||||
Remove Duplicate Letters | Solution Test |
Solution Test |
|||||
Top K Frequent Words | Solution Test |
||||||
Decode String | Solution Test |
||||||
Minimum Window Substring | Solution Test |
||||||
String Matching | Solution Test |
||||||
Custom Sort String | Solution Test |
||||||
Shortest Completing Word | Solution Test |
||||||
Push Dominoes | Solution Test |
Permutation
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Permutation(Apple) | Solution Test |
Solution Test |
Solution Test |
Greedy
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Permutation(Apple) | Solution Test |
Hint: When it asking maximum, minmum, optimal, this could be a dynamic programming problem
Problem List |
Difficulty |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|---|
Fibonacci | Solution Test |
Solution Test |
Solution Test |
Solution Test |
||||
Coin Change | Solution Test |
Solution Test |
||||||
Knapsack | Solution Test |
Solution Test |
||||||
Longest Common Subsequence(Linkedin) | Solution Test |
Solution Test |
||||||
Subset to Sum | Solution Test |
Solution Test |
||||||
Maximal Square | Solution Test |
|||||||
Longest Increasing Subsequence | Solution Test |
|||||||
Largest Rectangle in Histogram | Solution Test |
|||||||
Wildcard Matching | Solution Test |
|||||||
Predict Winner | Solution Test |
|||||||
2 Keys Keyboard | Solution Test |
|||||||
Edit Distance | Solution Test |
Solution Test |
||||||
Print House | Solution Test |
Solution Test |
||||||
Maximum Length of Repeated Subarray | Solution Test |
|||||||
Marbles in Three Baskets | Solution Test |
|||||||
Split Array With Same Average | Solution Test |
|||||||
Distinct Subsequences Total | Solution Test |
|||||||
Decode Ways II | Solution Test |
|||||||
Min Cost Climbing Stairs | Solution Test |
|||||||
heapest Flights Within K Stops | Solution Test |
Binary Search
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Binary Search in rotated order array | Solution Test |
Solution Test |
Solution Test |
||||
Lookup Latest Good Version(Facebook) | Solution Test |
||||||
Random Color(Uber) | Solution Test |
Graph
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Topology Sort(Apple) | Solution Test |
||||||
Dijkstra Algorithm | Solution Test |
||||||
Minimum Spanning Tree(Prim, Krusal) | Solution Test |
Geometry
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Valid Triangle Number | Solution Test |
||||||
Max Points on a Line | Solution Test |
Data Structure
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Trie | Solution Test |
||||||
LRU(Salesforce/Amazon) | Solution Test |
||||||
LFU | Solution Test |
||||||
Binary Heap | Solution Test |
Solution Test |
|||||
Magic Dictionary | Solution Test |
Solution Test |
|||||
Map Sum Pairs | Solution Test |
||||||
Find Median from Data Stream | Solution Test |
||||||
Fenwick Tree | Solution Test |
||||||
Range Module | Solution Test |
||||||
All One | Solution Test |
||||||
Insert Delete GetRandom O(1) | Solution Test |
||||||
Red-Black Tree | Solution Test |
||||||
Palindrome | Solution Test |
||||||
Product of the Last K Numbers | Solution Test |
||||||
Iterator for Combination | Solution Test |
Backtracking
Medium
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Generate Parentheses | Solution Test |
||||||
Pattern Matching | Solution Test |
Hashtable
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Binary Subarrays With Sum | Solution Test |
||||||
Rabbits in Forest | Solution Test |
||||||
Longest String Chain | Solution Test |
||||||
Sort Characters By Frequency | Solution Test |
||||||
Sparse Matrix Multiplication | Solution Test |
Union and Find
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Friend Circles | Solution Test |
Double Pointer
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Long Pressed Name | Solution Test |
||||||
Fruit Into Baskets | Solution Test |
Range
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Smallest Range | Solution Test |
BFS/DFS
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
Super Palindromes | Solution Test |
||||||
WordLadder | Solution Test |
||||||
Open the Lock | Solution Test |
Design
Problem List |
Java |
Python |
C++ |
Swift |
JavaScript |
Scala |
Go |
---|---|---|---|---|---|---|---|
PackageManager | Solution |
||||||
Amazon 1 Amazon 2 | Solution Test |
Solution Test |
Advanced algorithm
Design Pattern
Pattern
Creational
Pattern List |
Solution 1 |
Solution 2 |
Solution 3 |
Solution 4 |
---|---|---|---|---|
Abstract Factory | ||||
Builder | ||||
Singleton | Early Initialization | Lazy Initialization | Class holder | Enum |
Structural
Pattern List |
Solution 1 |
Solution 2 |
Solution 3 |
Solution 4 |
---|---|---|---|---|
Adapter | ||||
Bridge | ||||
Composite | ||||
Decrorator | ||||
Facade | ||||
FlyWeight | Generic | |||
Proxy |
Behavioral
Pattern List |
Solution 1 |
Solution 2 |
Solution 3 |
Solution 4 |
---|---|---|---|---|
Chain of Responsibility | ||||
Command | ||||
Iterpreter | ||||
Iterator | ||||
Mediator | ||||
Memento | ||||
Observer(Listener) | ||||
State | ||||
Strategy | ||||
Visitor |
Anti-Pattern
Multiple Thread Programming
System Design Practice
Concept
Proxies
Load Balancing
Caching
- Distributed Cache
- MemCached
- Redis
Sharding and Data Partition
-[Horizontal partitioning vs Vertical Partitioning]
Deal with Sharing Problem
- [Joins and Denormalization]
- [Referential integrity]
- [Rebalancing]
Consistent Hashing
Copysets
CAP Theorem(Consistency,Availability,Partition Tolerance)
Storage
- LSM vs B-Tree Link1
Vector Clock
Protocol
Event Update
-[Long-Polling(pull) vs WebSockets vs Server-Sent Events(push)]
Practice
SQL
Question |
My SQL |
Oracle |
SQL Server |
---|---|---|---|
Combine Two Tables | Solution |
||
Second Highest Salary | Solution |
||
Rank Scores | Solution |
||
Employees Earning More Than Their Managers | Solution |
||
Duplicate Emails | Solution |
||
Customers Who Never Order | Solution |
||
Rising Temperature | Solution |