This repostitory contains code for following-
- Basic Concepts -
- GeeksForGeeks
- HackerRank
- HackerEarth
- CodeChef
- LeetCode
# | Title | Solution | Time | Space |
---|---|---|---|---|
1 | Adjacency List Undirected | java | ||
2 | Adjacency Matrix Directed | java | ||
3 | Adjacency Matrix Undirected | java | ||
4 | BFS Directed | java | ||
5 | BFS Undirected | java | ||
6 | Connected Components Undirected Graph | java | O(|V + E|) | O(|V|) |
7 | Detect Cycle in Undirected Graph using Union and Find | java | O(|V * log(V)|) | O(|V + E|) |
# | Title | Solution | Time | Space | Notes |
---|---|---|---|---|---|
1 | Bubble Sort | java | W(|N|) O(|N*N|) | O(|1|) | In-Place, Stable |
2 | Recursive Bubble Sort | java | W(|N|) O(|N*N|) | O(|1|) | In-Place, Stable |
3 | Counting Sort | java | |||
4 | Insertion Sort | java | W(|N|) O(|N*N|) | O(|1|) | In-Place, Stable, Online |
5 | Recursive Insertion Sort | java | W(|N|) O(|N*N|) | O(|1|) | In-Place, Stable, Online |
6 | Radix Sort | java | |||
7 | Selection Sort | java | |||
8 | Merge Sort | java | O(|N*log(N)|) | O(|N|) | Stable |
9 | Merge Sort Linked List | java | O(|N*log(N)|) | O(|N|) | Stable |
10 | Iterative Merge Sort | java | O(|N*log(N)|) | O(|N|) | Stable |
11 | Quick Sort | java | O(|N*log(N)|) | O(|1|) | In-Place, Stable |
12 | Iterative Quick Sort | java | O(|N*log(N)|) | O(|1|) | In-Place, Stable |
# | Title | Solution | Time | Space | Notes |
---|---|---|---|---|---|
1 | Factorial | java | O(|N*N|) | O(|1|) | |
2 | Permutation of a given String | java | |||
3 | Selection Sort Recursive | java |
# | Title | Solution | Time | Space | Notes |
---|---|---|---|---|---|
1 | Fibonacci Number DP | java | O(|N|) | O(|N|) | |
2 | Fibonacci Number with Recursion | java | O(|2^N|) | O(|N|) | |
3 | Fibonacci Series with Recursion | java | O(|N|) | O(|1|) | |
4 | Fibonacci Series without Recursion | java | O(|N|) | O(|1|) | |
5 | Edit/Levenshtein Distance | java | O(|M*N|) | O(|M*N|) | |
6 | Min Cost Path | java | O(|M*N|) | O(|M*N|) |
# | Title | Solution | Time | Space | Notes |
---|---|---|---|---|---|
1 | Sorted Activity Selection Problem | java | O(|N|) | O(|1|) | |
2 | Unsorted Activity Selection Problem | java | O(|N*log(N)|) | O(|1|) | |
3 | Kruskal Minimum Spanning Tree | java | O(|Elog(E)|) or O(|Elog(V)|) | O(|V + E|) |
# | Title | Solution | Time | Space | Notes |
---|---|---|---|---|---|
1 | Prime Factors | c++ | O(|log(N)|) | O(|1|) | |
2 | Sieve of Eratosthenes | c++ | O(|N*log(log(N))|) | O(|N|) |
# | Title | Solution | Time | Space | Notes |
---|---|---|---|---|---|
1 | Disjoint Set | java | O(|log(N)|) | O(|N|) | Using Path Compression and Union by Rank |
# | Problem | Solution | Time | Space |
---|---|---|---|---|
1 | Largest Even Number | java | ||
2 | Palindrome String | java | ||
3 | Sum Of Digit Is Palindrome Or Not | java | ||
4 | X Total Shapes | java | ||
5 | Floyd Tortoise and Hare | java | O(|N|) | |
6 | Sort The Array | java | O(|N*log(N)|) | |
7 | N Meetings in One Room | java | O(|N*log(N)|) | |
8 | Detect Cycle in Directed Graph | java | O(|V + E|) | |
9 | Edit Distance | java | O(|M*N|) | |
10 | Highest Prime | c++ | ||
11 | Largest Prime Factor | c++ | ||
12 | Path in Matrix | java | ||
13 | Least Prime Factor | C++ | ||
14 | Check for Subsequence | C++ |
# | Problem | Solution | Time | Space | Difficulty | Points |
---|---|---|---|---|---|---|
1 | Big Sorting | java | Easy | 20 | ||
2 | Insertion Sort 1 | java | O(|N*N|) | O(|1|) | Easy | 30 |
3 | Insertion Sort 2 | java | O(|N*N|) | O(|1|) | Easy | 30 |
# | Problem | Solution | Time | Space | Difficulty | Points |
---|---|---|---|---|---|---|
1 | Beautiful Binary String | java | Easy | 20 | ||
2 | Gemstones | java | Easy | 20 | ||
3 | Making Anagrams | java | Easy | 30 | ||
4 | Mars Exploration | java | Easy | 15 | ||
5 | The Love Letter Mystery | java | Easy | 20 | ||
6 | Game of Thrones 1 | java | O(|N|) | O(|1|) | Easy | 30 |
7 | Anagram | java | O(|N|) | O(|1|) | Easy | 25 |
8 | Two Strings | java | O(|N|) | O(|1|) | Easy | 25 |
# | Problem | Solution | Time | Space | Difficulty | Points |
---|---|---|---|---|---|---|
1 | Roads and Libraries | java | O(|V|) | O(|V|) | Medium | 30 |
2 | Journey to the Moon | java | O(|V + E|) | O(|V|) | Medium | 50 |
# | Problem | Solution | Time | Space | Difficulty | Points |
---|---|---|---|---|---|---|
1 | Fibonacci Modified | java | O(|N|) | O(|1|) | Medium | 45 |
2 | The Coin Change Problem | java | O(|total*coins|) | O(|total|) | Hard | 60 |
# | Problem | Solution | Time | Space | Points | Notes |
---|---|---|---|---|---|---|
1 | Alex And Priority Queues | java | ||||
2 | Alex And Requests | java | ||||
3 | Disconnected Graph | java | ||||
4 | Sum of Subsets | java | ||||
5 | RhezoAndBigPowers | java | 30 | Used BigInteger build in modPow() function | ||
6 | Roy And Trains | java | 20 | |||
6 | Roy And Wobbly Numbers | java | 20 | |||
7 | Sherlock And Dates | java | 20 | |||
8 | The Best Player | java | 20 | |||
9 | Crazy Matrix | java | 30 | |||
10 | Crushing Violence | java | 20 | |||
10 | Fizz Buzz | java C++ | 20 |
# | Problem | Solution | Time | Space | Points | Notes |
---|---|---|---|---|---|---|
1 | Find The String | java / python | ||||
2 | Fredo and Two Strings | cpp / java |
Follow my progress -