https://github.com/jharsh1202/dsa-solved-problems
The repository contains solutions to various problems on LeetCode/GeekForGeeks and other platforms.
https://github.com/jharsh1202/dsa-solved-problems
Last synced: about 1 month ago
JSON representation
The repository contains solutions to various problems on LeetCode/GeekForGeeks and other platforms.
- Host: GitHub
- URL: https://github.com/jharsh1202/dsa-solved-problems
- Owner: jharsh1202
- Created: 2021-08-01T03:50:47.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-15T12:58:48.000Z (almost 4 years ago)
- Last Synced: 2025-02-14T21:27:09.550Z (3 months ago)
- Language: C++
- Size: 269 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![]()
# DSA-Solved-Problems
I have solved quite number of problems from GFG, Leetcode and in other platforms, in this repository i will be sharing solution to some important question to build command over Data Structure and Algorithm, the solution to problems are highly optimised and concise.
This repository can be used as help for those who are new to competitive programming.
The code is merely a snippet (as solved on GFG) & hence is not executable in a c++ compiler.## Topic-Wise
* [Array](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Array)
* [String](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#String)
* [Linked List](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Linked-List)
* [Stack and Queue](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Stack-and-Queue)
* [Binary Tree](https://github.com/nkits9/DSA-Solved-Problems#binary-tree)
* [Heap](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Heap)
* [Recursion](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Recursion)
* [Hashing](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Hashing)
* [Graph](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Graph)
* [Greedy](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Greedy)
* [Divide and Conquer](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Divide-and-Conquer)
* [Backtracking](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Backtracking)
* [Dynamic Programming](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Dynamic-Programming)
* [Bit Magic](https://github.com/nkits9/GeeksForGeeks-Solved-Problems#Bit-Magic)## General C++ Solutions
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1| [Count Primes with Sieve of Eratosthenes](https://leetcode.com/problems/count-primes/) | [Solution]() | | | Easy* | |
2| [Largest prime factor with Sieve of Eratosthenes](https://practice.geeksforgeeks.org/problems/largest-prime-factor2601/1#) | [Solution](https://practice.geeksforgeeks.org/viewSol.php?subId=d8699d97dc058d35aa1dc7d11dd65d3c&pid=703958&user=harshitjain11) | | | Medium* | |
3| [Pascal Triangle Row](https://leetcode.com/problems/pascals-triangle-ii) | [Solution](https://leetcode.com/submissions/detail/530904040/) | | | Easy | |
4| [Pascal Triangle Row With Combinations](https://leetcode.com/problems/pascals-triangle-ii) | [Solution](https://leetcode.com/submissions/detail/531052262/) | | | Easy/M* | |
5| [Missing Number with Sum of N Nums](https://leetcode.com/problems/missing-number/submissions/) | [Solution](https://leetcode.com/submissions/detail/531067018/) | | | Easy | |
6| [Pythagorean Triplet in Array](https://practice.geeksforgeeks.org/problems/pythagorean-triplet3018/1#) | [Solution]() | | | Easy | |
7| [Pythagorean Triplet in Array Optimized](https://practice.geeksforgeeks.org/problems/pythagorean-triplet3018/1#) | [Solution](https://practice.geeksforgeeks.org/viewSol.php?subId=c807667804f83e91370c8f1016767c20&pid=702805&user=harshitjain11) | | | Easy* | |
8| [Binary Numbers Addition]() | [Solution]() | | |Easy* | |
9| [Array-Search-Algorithms]() | [Solution]() | | |Easy* | |
10| [Array-Sort-Algorithms]() | [Solution]() | | |Easy* | |
11| [Sum-of-SubArrays]() | [Solution]() | | |Easy* | |
12| [Sum Of SubArray Equals K Count](https://leetcode.com/problems/subarray-sum-equals-k) | [Solution](https://leetcode.com/submissions/detail/534648038/) | | |Medium* | |
13| [Sum Of All SubArrays](https://practice.geeksforgeeks.org/problems/sum-of-subarrays2229/1#) | [Solution](https://practice.geeksforgeeks.org/viewSol.php?subId=bea91de3dc94e9e77f809b3a89e8227a&pid=702706&user=harshitjain11) | | |Medium* | |
14| [Longest Arithmetic Progession Subarray Length](https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff47/00000000003bf4ed#problem) | [Solution]() | | |Easy* | |
15| [Record Breaker](https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff08/0000000000387171) | [Solution]() | | |Easy* | |
16| [First Repeating Element](https://practice.geeksforgeeks.org/problems/first-repeating-element4018/1#) | [Solution](https://practice.geeksforgeeks.org/viewSol.php?subId=137fbe921b6b0f1bd614edaeea745e52&pid=701716&user=harshitjain11) | | |Easy/M* | |## Array
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1| [Count pairs with given sum](https://practice.geeksforgeeks.org/problems/count-pairs-with-given-sum/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Count-pairs-with-given-sum.cpp) | | | Easy | |
2| [Find Missing And Repeating](https://practice.geeksforgeeks.org/problems/find-missing-and-repeating2512/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Find-Missing-And-Repeating.cpp) | _O(n)_ | _O(1)_ | Medium |:star2:|
3| [Merge Without Extra Space](https://practice.geeksforgeeks.org/problems/merge-two-sorted-arrays5135/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Merge-Without-Extra-Space.cpp) | | | Hard | |
4| [Container With Most Water](https://leetcode.com/problems/container-with-most-water/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Container-With-Most-Water.cpp) | _O(n)_ | _O(1)_ | Medium | |
5| [Count Primes](https://leetcode.com/problems/container-with-most-water/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Count-Primes.cpp) | _O(n)_ | _O(n)_ | Easy | Sieve of Eratosthenes |
6| [Sort an array of 0s, 1s and 2s](https://leetcode.com/problems/sort-colors/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Sort-arrays-of-0s-1s-and-2s.cpp) | _O(n)_ | _O(1)_ | Medium | |
7| [Kth Largest Element in an Array](https://leetcode.com/problems/kth-largest-element-in-an-array/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Kth-Largest-number.cpp) | _O(n)_ | _O(1)_ | Medium | Quickselect |
8| [First Missing Positive](https://leetcode.com/problems/first-missing-positive/submissions/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/First-Missing-Positive.cpp) | _O(n)_ | _O(1)_ | Hard | |## String
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|## Linked List
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Remove loop in Linked List](https://practice.geeksforgeeks.org/problems/remove-loop-in-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Remove-loop-in-Linked-List.cpp) |_O(n)_ | _O(1)_ | Medium | |
2 | [Delete without head pointer](https://practice.geeksforgeeks.org/problems/delete-without-head-pointer/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Delete-without-head-pointer.cpp) |_O(n)_ | _O(1)_ | Medium | |
3 | [Intersection Point in Y Shapped Linked Lists](https://practice.geeksforgeeks.org/problems/intersection-point-in-y-shapped-linked-lists/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Intersection-Point-in-Y-Shapped-Linked-Lists.cpp) |_O(n)_ | _O(1)_ | Medium | |
4 | [Reverse a Linked List in groups of given size](https://practice.geeksforgeeks.org/problems/reverse-a-linked-list-in-groups-of-given-size/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Reverse-a-Linked-List-in-groups-of-given-size.cpp) |_O(n)_ | _O(1)_ | Medium | |
5 | [Flattening a Linked List](https://practice.geeksforgeeks.org/problems/flattening-a-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Flattening-a-Linked-List.cpp) |_O(m*n)_ | _O(m+n)_ | Medium | |
6 | [*Merge Sort for Linked Lists](https://practice.geeksforgeeks.org/problems/sort-a-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Merge-sort-for-linked-list.cpp) |_O(nlogn)_ | _O(n)_ | Easy | |
7 | [*Sort Linked List of 0s, 1s, and 2s](https://practice.geeksforgeeks.org/problems/given-a-linked-list-of-0s-1s-and-2s-sort-it/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Sort-Linked-List-of-0s-1s-2s.cpp) |_O(n)_ | _O(1)_ | Easy | |
8| [*Add two numbers represented by linked lists](https://practice.geeksforgeeks.org/problems/add-two-numbers-represented-by-linked-lists/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Add-two-numbers-represented-by-linked-lists.cpp) |_O(n)_ | _O(1)_ | Easy | |
9 | [Pairwise swap elements of a linked list](https://practice.geeksforgeeks.org/problems/pairwise-swap-elements-of-a-linked-list-by-swapping-data/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Pairwise-swap-elements-of-a-linked-list.cpp) |_O(n)_ | _O(1)_ | Easy | |
10 | [Decimal Equivalent of Binary Linked List](https://practice.geeksforgeeks.org/problems/decimal-equivalent-of-binary-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Decimal-Equivalent-of-Binary-Linked-List.cpp) |_O(n)_ | _O(1)_ | Easy | |
11 | [Merge two sorted linked lists](https://practice.geeksforgeeks.org/problems/merge-two-sorted-linked-lists/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Merge-two-sorted-linked-lists.cpp) |_O(n)_ | _O(1)_ | Easy | |
12 | [Rotate a Linked List](https://practice.geeksforgeeks.org/problems/rotate-a-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Rotate-a-Linked-List.cpp) |_O(n)_ | _O(1)_ | Easy | |
13 | [Check if Linked List is Palindrome](https://practice.geeksforgeeks.org/problems/check-if-linked-list-is-pallindrome/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Check-if-Linked-List-is-Palindrome.cpp) |_O(n)_ | _O(n)_ | Easy | |
14 | [Nth node from end of linked list](https://practice.geeksforgeeks.org/problems/nth-node-from-end-of-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Nth-node-from-end-of-linked-list.cpp) |_O(n)_ | _O(1)_ | Easy | |
15 | [Detect Loop in linked list](https://practice.geeksforgeeks.org/problems/detect-loop-in-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Detect-Loop-in-linked-list.cpp) |_O(n)_ | _O(1)_ | Easy | |
16 | [Reverse a linked list](https://practice.geeksforgeeks.org/problems/reverse-a-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Reverse-a-linked-list.cpp) |_O(n)_ | _O(1)_ | Easy | |
17 | [Finding middle element in a linked list](https://practice.geeksforgeeks.org/problems/finding-middle-element-in-a-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Finding-middle-element-in-a-linked-list.cpp) |_O(n)_ | _O(1)_ | Basic | |## Stack and Queue
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Longest valid Parentheses](https://practice.geeksforgeeks.org/problems/longest-valid-parentheses/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Longest-valid-Parentheses.cpp) |_O(n)_ | _O(n)_ | Hard | |
2 | [Maximum of all subarrays of size k](https://practice.geeksforgeeks.org/problems/maximum-of-all-subarrays-of-size-k/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Maximum-of-all-subarrays-of-size-k.cpp) |_O(n)_ | _O(n)_ | Medium | |
3 | [Parenthesis Checker](https://practice.geeksforgeeks.org/problems/parenthesis-checker/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Parenthesis-Checker.cpp) |_O(n)_ | _O(n)_ | Medium | |
3 | [Decode String](https://leetcode.com/problems/decode-string/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Decode-String.cpp) |_O(n)_ | _O(n)_ | Medium | |
4 | [*Get minimum element from stack](https://practice.geeksforgeeks.org/problems/get-minimum-element-from-stack/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Get-minimum-element-from-stack.cpp) |_O(1)_ | _O(1)_ | Medium | |
5 | [Largest Rectangle in Histogram](https://leetcode.com/problems/largest-rectangle-in-histogram/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Largest-Rectangle-in-Histogram.cpp) |_O(n)_ | _O(n)_ | Medium | |
6 | [*Next larger element](https://practice.geeksforgeeks.org/problems/next-larger-element/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Next-larger-element.cpp) |_O(n)_ | _O(n)_ | Medium | |
7 | [Circular tour](https://practice.geeksforgeeks.org/problems/circular-tour-1587115620/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Circular-tour.cpp) |_O(n)_ | _O(n)_ | Medium | |
8 | [Infix to Postfix](https://practice.geeksforgeeks.org/problems/infix-to-postfix/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Infix-to-Postfix.cpp) |_O(n)_ | _O(n)_ | Medium | |
9 | [Evaluation of Postfix Expression](https://practice.geeksforgeeks.org/problems/evaluation-of-postfix-expression/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Evaluation-of-Postfix-Expression.cpp) |_O(n)_ | _O(n)_ | Easy | |
10 | [Sort a stack](https://practice.geeksforgeeks.org/problems/sort-a-stack/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Sort-a-stack.cpp) |_O(n^2)_ | _O(n)_ | Easy | |
11 | [Delete middle element of a stack](https://practice.geeksforgeeks.org/problems/delete-middle-element-of-a-stack/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Delete-middle-element-of-a-stack.cpp) |_O(n)_ | _O(n)_ | Easy | |
12 | [Stack using two queues](https://practice.geeksforgeeks.org/problems/stack-using-two-queues/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Stack-using-two-queues.cpp) |_O(n)_ | _O(1)_ | Easy | |
13 | [Queue using two Stacks](https://practice.geeksforgeeks.org/problems/queue-using-two-stacks/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Queue-using-two-Stacks.cpp) |_O(n)_ | _O(1)_ | Easy | |
14 | [Implement two stacks in an array](https://practice.geeksforgeeks.org/problems/implement-two-stacks-in-an-array/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Implement-two-stacks-in-an-array.cpp) |_O(1)_ | _O(1)_ | Easy | |
15 | [Implement Queue using Linked List](https://practice.geeksforgeeks.org/problems/implement-queue-using-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Implement-Queue-using-Linked-List.cpp) |_O(1)_ | _O(1)_ | Basic | |
16 | [Implement Stack using Linked List](https://practice.geeksforgeeks.org/problems/implement-stack-using-linked-list/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Implement-Stack-using-Linked-List.cpp) |_O(1)_ | _O(1)_ | Basic | |
17 | [Implement Queue using array](https://practice.geeksforgeeks.org/problems/implement-queue-using-array/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Implement-Queue-using-array.cpp) |_O(1)_ | _O(1)_ | Basic | |
18 | [Implement stack using array](https://practice.geeksforgeeks.org/problems/implement-stack-using-array/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Implement-stack-using-array.cpp) |_O(1)_ | _O(1)_ | Basic | |## Binary Tree
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Binary Tree to DLL](https://practice.geeksforgeeks.org/problems/binary-tree-to-dll/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Binary-Tree-to-DLL.cpp) | _O(H)_ | _O(H)_ | Hard | |
2 | [Maximum Path Sum between 2 Leaf Nodes](https://practice.geeksforgeeks.org/problems/maximum-path-sum/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Maximum-Path-Sum-between-2-Leaf-Nodes.cpp) | _O(n)_ | _O(H)_ | Hard | |
3 | [Top View of Binary Tree](https://practice.geeksforgeeks.org/problems/top-view-of-binary-tree/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Top-View-of-Binary-Tree.cpp) | _O(n)_ | _O(n)_ | Medium | |
4 | [Vertical Traversal of Binary Tree](https://practice.geeksforgeeks.org/problems/print-a-binary-tree-in-vertical-order/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Vertical-Traversal-of-Binary-Tree.cpp) |_O(n)_ | _O(n)_ | Medium | |
5 | [Connect Nodes at Same Level](https://practice.geeksforgeeks.org/problems/connect-nodes-at-same-level/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Connect-Nodes-at-Same-Level.cpp) | _O(n)_ | _O(n)_ | Medium | |
6 | [Check for BST](https://practice.geeksforgeeks.org/problems/check-for-bst/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Check-for-BST.cpp) | _O(n)_ | _O(H)_ | Medium | |
7 | [Delete a node from BST](https://practice.geeksforgeeks.org/problems/delete-a-node-from-bst/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Delete-a-node-from-BST.cpp) | _O(H)_ | _O(H)_ | Medium | |
8 | [Inorder Successor in BST](https://practice.geeksforgeeks.org/problems/inorder-successor-in-bst/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Inorder-Successor-in-BST.cpp) | _O(H)_ | _O(1)_ | Easy | |
9 | [Left View of Binary Tree](https://practice.geeksforgeeks.org/problems/left-view-of-binary-tree/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Left-View-of-Binary-Tree.cpp) | _O(n)_ | _O(n)_ | Easy | |
10 | [Lowest Common Ancestor in a BST](https://practice.geeksforgeeks.org/problems/lowest-common-ancestor-in-a-bst/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Lowest-Common-Ancestor-in-a-BST.cpp) | _O(n)_ | _O(n)_ | Easy | |
11 | [Insert a node in a BST](https://practice.geeksforgeeks.org/problems/insert-a-node-in-a-bst/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Insert-a-node-in-a-BST.cpp) | _O(n)_ | _O(n)_ | Easy | |
12 | [k-th smallest element in BST](https://practice.geeksforgeeks.org/problems/find-k-th-smallest-element-in-bst/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/kth-smallest-element-in-BST.cpp) | _O(n)_ | _O(n)_ | Medium | |
13 | [Diagonal Sum In Binary Tree](https://practice.geeksforgeeks.org/problems/diagonal-sum-in-binary-tree/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Diagonal-Sum-In-Binary-Tree.cpp) | _O(n)_ | _O(n)_ | Easy | |
14 | [Array to BST](https://practice.geeksforgeeks.org/problems/array-to-bst/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Array-to-BST.cpp) | _O(n)_ | _O(n)_ | Easy | |
15 | [Mirror Tree](https://practice.geeksforgeeks.org/problems/mirror-tree/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Mirror-Tree.cpp) | _O(n)_ | _O(n)_ | Easy | |
21 | [Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Diameter-of-Binary-Tree.cpp) | _O(n)_ | _O(n)_ | Easy | |
16 | [Reverse Level Order Traversal](https://practice.geeksforgeeks.org/problems/reverse-level-order-traversal/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Reverse-Level-Order-Traversal.cpp) | _O(n)_ | _O(n)_ | Easy | |
17 | [Level order traversal in spiral form](https://practice.geeksforgeeks.org/problems/level-order-traversal-in-spiral-form/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Level-order-traversal-in-spiral-form.cpp) | _O(n)_ | _O(n)_ | Easy | |
18 | [Level order traversal Line by Line](https://practice.geeksforgeeks.org/problems/level-order-traversal-line-by-line/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Level-order-traversal-Line-by-Line.cpp) | _O(n)_ | _O(n)_ | Easy | |
19 | [Level order traversal](https://practice.geeksforgeeks.org/problems/level-order-traversal/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Level-order-traversal.cpp) | _O(n)_ | _O(n)_ | Easy | |
20 | [Height of Binary Tree, Number of Leaves](https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Height-of-Binary-Tree.cpp) | _O(n)_ | _O(n)_ | Basic | |
21 | [Preorder, Inorder and Postorder Traverasal](https://practice.geeksforgeeks.org/explore/?category%5B%5D=Tree&difficulty%5B%5D=-1&page=1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Preorder-Inorder-Postorder-Traverasal.cpp) | _O(n)_ | _O(n)_ | Basic | |## Heap
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Find median in a stream](https://practice.geeksforgeeks.org/problems/find-median-in-a-stream/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Find-median-in-a-stream.cpp) | _O(nlogn)_ | _O(n)_ | Hard | |
2 | [*Huffman Encoding ](https://practice.geeksforgeeks.org/problems/huffman-encoding/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Huffman-Encoding.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
3 | [*Merge k Sorted Arrays ](https://practice.geeksforgeeks.org/problems/merge-k-sorted-arrays/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Merge-k-Sorted-Arrays.cpp) | _O(nklogk)_ | _O(n)_ | Medium | |
4 | [*Merge K sorted linked lists](https://practice.geeksforgeeks.org/problems/merge-k-sorted-linked-lists/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Merge-K-sorted-linked-lists.cpp) | _O(nklogk)_ | _O(n)_ | Medium | |
5 | [Minimum Cost of ropes](https://practice.geeksforgeeks.org/problems/minimum-cost-of-ropes/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Minimum-Cost-of-ropes.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
6 | [Rearrange characters](https://practice.geeksforgeeks.org/problems/rearrange-characters/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Rearrange-characters.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
7 | [Kth largest element in a stream](https://practice.geeksforgeeks.org/problems/kth-largest-element-in-a-stream/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Kth-largest-element-in-a-stream.cpp) | _O(nlogk)_ | _O(n)_ | Medium | |
8 | [*Is Binary Tree Heap](https://practice.geeksforgeeks.org/problems/is-binary-tree-heap/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Is-Binary-Tree-Heap.cpp) |_O(n)_ | _O(n)_ | Easy | |
9 | [Binary Heap Operations](https://practice.geeksforgeeks.org/problems/operations-on-binary-min-heap/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Binary-Heap-Operations.cpp) |_O(Q*H )_ | _O(1)_ | Easy | |
10 | [Heap Sort](https://practice.geeksforgeeks.org/problems/heap-sort/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Heap-Sort.cpp) | _O(nlogn)_ | _O(1)_ | Easy | |
11 | [Huffman Decoding](https://practice.geeksforgeeks.org/problems/huffman-decoding/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Huffman-Decoding.cpp) | _O(n)_ | _O(n)_ | Easy | |## Recursion
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|## Hashing
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Relative Sorting](https://practice.geeksforgeeks.org/problems/relative-sorting/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Relative-Sorting.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
2 | [Longest consecutive subsequence](https://practice.geeksforgeeks.org/problems/longest-consecutive-subsequence/0/?category[]=Hash&problemStatus=solved&page=1&query=category[]HashproblemStatussolvedpage1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Longest-consecutive-subsequence.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
3 | [Sorting Elements of an Array by Frequency](https://practice.geeksforgeeks.org/problems/sorting-elements-of-an-array-by-frequency-1587115621/1/?category[]=Hash&problemStatus=solved&page=1&query=category[]HashproblemStatussolvedpage1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Sorting-Elements-of-an-Array-by-Frequency.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
4 | [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Longest-Substring-Without-Repeating-Characters.cpp) |_O(n)_ | _O(n)_ | Medium |:star2:|
5 | [Partition Labels](https://leetcode.com/problems/partition-labels/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Partition-Labels.cpp) |_O(n)_ | _O(n)_ | Medium | |## Graph
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Minimum Cost Path](https://practice.geeksforgeeks.org/problems/minimum-cost-path/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Minimum-Cost-Path.cpp) | _O(VLogV)_| _O(V)_ | Hard | |
2 | [Hamiltonian Path](https://practice.geeksforgeeks.org/problems/hamiltonian-path/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Hamiltonian-Path.cpp) | _O(V^V)_| _O(V+E)_ | Medium | |
3 | [Bipartite Graph](https://practice.geeksforgeeks.org/problems/bipartite-graph/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Bipartite-Graph.cpp) | _O(V+E)_| _O(V+E)_ | Medium | |
4 | [Prims Minimum Spanning Tree](https://practice.geeksforgeeks.org/problems/minimum-spanning-tree/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Minimum-Spanning-Tree.cpp) | _O(V^2)_ | _O(V^2)_ | Medium | |
5 | [Kruskal’s Minimum Spanning Tree](https://www.geeksforgeeks.org/kruskals-minimum-spanning-tree-algorithm-greedy-algo-2/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Kruskal’s-Minimum-Spanning-Tree.cpp) | _O(V)_ | _O(ElogE)_ | Medium | |
6 | [Detect cycle in an undirected graph](https://practice.geeksforgeeks.org/problems/detect-cycle-in-an-undirected-graph/1) | [Solution](https://www.cdn.geeksforgeeks.org/union-find/) | _O(V+E)_ | _O(V+E)_ | Medium | _Union Find_ |
7 | [Detect cycle in a directed graph](https://practice.geeksforgeeks.org/problems/detect-cycle-in-a-directed-graph/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Detect-cycle-in-a-directed-graph.cpp) | _O(V+E)_ | _O(V+E)_ | Medium | |
8 | [Detect cycle in an undirected graph](https://practice.geeksforgeeks.org/problems/detect-cycle-in-an-undirected-graph/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Detect-cycle-in-an-undirected-graph.cpp) | _O(V+E)_ | _O(V+E)_ | Medium | |
9 | [Floyd Warshall](https://practice.geeksforgeeks.org/problems/implementing-floyd-warshall/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Floyd-Warshall.cpp) | _O(V^3)_ | _O(V^2)_ | Medium | |
10 | [Negative weight cycle](https://practice.geeksforgeeks.org/problems/negative-weight-cycle/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Negative-Weight-Cycle.cpp) |_O(V*E)_ | _O(V)_| Medium | |
11 | [Implementing Dijkstra](https://practice.geeksforgeeks.org/problems/implementing-dijkstra-set-1-adjacency-matrix/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Implementing-Dijkstra.cpp) |_O(V^2)_ | _O(V)_ | Medium | |
12 | [Flood fill Algorithm](https://practice.geeksforgeeks.org/problems/flood-fill-algorithm/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Flood-fill-Algorithm.cpp) | _O(E)_| _O(V^2)_ | Medium | |
13 | [Find the number of islands](https://practice.geeksforgeeks.org/problems/find-the-number-of-islands/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Find-the-number-of-islands.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
14 | [Unit Area of largest region of 1's](https://practice.geeksforgeeks.org/problems/length-of-largest-region-of-1s/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Unit-Area-of-largest-region-of-1's.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
15 | [Snake and Ladder Problem](https://practice.geeksforgeeks.org/problems/snake-and-ladder-problem/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Snake-and-Ladder-Problem.cpp) | _O(N)_ | _O(N)_ | Medium | |
16 | [Knight Walk](https://practice.geeksforgeeks.org/problems/knight-walk/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Knight-Walk.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
17 | [X Total Shapes](https://practice.geeksforgeeks.org/problems/x-total-shapes/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/X-Total-Shapes.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
18 | [Rotten Oranges](https://practice.geeksforgeeks.org/problems/rotten-oranges/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Rotten-Oranges.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
19 | [Shortest Source to Destination Path](https://practice.geeksforgeeks.org/problems/shortest-source-to-destination-path/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Shortest-Source-to-Destination-Path.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
20 | [Distance of nearest cell having 1](https://practice.geeksforgeeks.org/problems/distance-of-nearest-cell-having-1/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Distance-of-nearest-cell-having-1.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
21 | [Strongly Connected Components (Kosaraju's Algo)](https://practice.geeksforgeeks.org/problems/strongly-connected-components-kosarajus-algo/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Strongly-Connected-Components.cpp) |_O(V+E)_ | _O(V+E)_| Medium | |
22 | [Topological sort](https://practice.geeksforgeeks.org/problems/topological-sort/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Topological-Sort.cpp) | _O(V+E)_ | _O(V+E)_ | Medium | |
23 | [*Villain Con](https://practice.geeksforgeeks.org/problems/villain-con/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Villain-Con.cpp) |_O(V+E)_ | _O(V+E)_| Easy | |
24 | [Mother Vertex](https://practice.geeksforgeeks.org/problems/mother-vertex/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Mother-Vertex.cpp) | _O(V+E)_ | _O(V+E)_ | Easy | |
25 | [Count the paths](https://practice.geeksforgeeks.org/problems/count-the-paths/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Count-the-paths.cpp) |_O(V^V)_ | _O(V^V)_ | Easy | |
26 | [DFS of graph](https://practice.geeksforgeeks.org/problems/depth-first-traversal-for-a-graph/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/DFS-on-graph.cpp) | _O(V+E)_ | _O(V+E)_ | Easy | |
27 | [BFS of graph](https://practice.geeksforgeeks.org/problems/bfs-traversal-of-graph/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/BFS-of-graph.cpp) | _O(V+E)_ | _O(V+E)_ | Easy | |
28 | [Print adjacency list](https://practice.geeksforgeeks.org/problems/print-adjacency-list/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Print-adjacency-list.cpp) | _O(V+E)_ | _O(V+E)_ | Easy | |## Greedy
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [*Water Connection Problem](https://practice.geeksforgeeks.org/problems/water-connection-problem/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Water-Connection-Problem.cpp) | _O(n)_ | _O(n)_ | Medium | |
2 | [Coin Piles](https://practice.geeksforgeeks.org/problems/coin-piles/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Coin-Piles.cpp) | _O(n^2)_ | _O(n)_ | Medium | |
3 | [Minimum Platforms](https://practice.geeksforgeeks.org/problems/minimum-platforms/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Minimum-Platforms.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
4 | [Minimize the heights](https://practice.geeksforgeeks.org/problems/minimize-the-heights/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Minimize-the-heights.cpp) | _O(nlogn)_ | _O(n)_ | Medium | |
5 | [Job Sequencing Problem](https://practice.geeksforgeeks.org/problems/job-sequencing-problem/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Job-Sequencing-Problem.cpp) | _O(n^2)_ | _O(n)_ | Medium | |
6 | [7 Segment Display](https://practice.geeksforgeeks.org/problems/7-segment-display/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/7-Segment-Display.cpp) | _O(n)_ | _O(n)_ | Medium | |
7 | [Activity Selection](https://practice.geeksforgeeks.org/problems/activity-selection/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Activity-Selection.cpp) | _O(nlogn)_ | _O(n)_ | Easy | |
8 | [N meetings in one room](https://practice.geeksforgeeks.org/problems/n-meetings-in-one-room/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/N-meetings-in-one-room.cpp) | _O(n^2)_ | _O(n)_ | Easy | |
9 | [Largest number possible](https://practice.geeksforgeeks.org/problems/largest-number-possible/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Largest-number-possible.cpp) | _O(n)_ | _O(n)_ | Easy | |
10 | [*Minimum Swaps for Bracket Balancing](https://practice.geeksforgeeks.org/problems/minimum-swaps-for-bracket-balancing/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Minimum-Swaps-for-Bracket-Balancing.cpp) | _O(n)_ | _O(n)_ | Easy | |
11 | [Fact Digit Sum](https://practice.geeksforgeeks.org/problems/fact-digit-sum/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Fact-Digit-Sum.cpp) | _O(n)_ | _O(n)_ | Easy | |
12 | [Raju and coins](https://practice.geeksforgeeks.org/problems/raju-and-coins/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Raju-and-coins.cpp) | _O(k)_ | _O(n)_ | Easy | |## Divide and Conquer
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Binary Search](https://practice.geeksforgeeks.org/problems/binary-search-1587115620/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Binary-Search.cpp) | _O(logn)_ | _O(1)_ | Basic | |
2 | [Merge Sort](https://practice.geeksforgeeks.org/problems/merge-sort/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/Sorting/Merge-Sort.cpp) | _O(nlogn)_ | _O(n)_ | Easy | |
3 | [Quick Sort](https://practice.geeksforgeeks.org/problems/quick-sort/1) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/Sorting/Quick-Sort.cpp) | _O(nlogn)_ | _O(n)_ | Easy | |
4 | [Search in a Rotated Array](https://practice.geeksforgeeks.org/problems/search-in-a-rotated-array/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Search-in-a-Rotated-Array.cpp) | _O(logn)_ | _O(n)_ | Easy | |
5 | [Modular Exponentiation for large numbers](https://practice.geeksforgeeks.org/problems/modular-exponentiation-for-large-numbers/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Modular-Exponentiation-for-large-numbers.cpp) | _O(logn)_ | _O(n)_ | Medium | |
6 | [The Nth Fibonnaci](https://practice.geeksforgeeks.org/problems/the-nth-fibonnaci/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Nth-Fibonnaci.cpp) | _O(logn)_ | _O(n)_ | Easy | |
7 | [Largest-prime-factor](https://practice.geeksforgeeks.org/problems/largest-prime-factor/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Largest-prime-factor.cpp) | | | Medium | |## Backtracking
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [Combination Sum](https://practice.geeksforgeeks.org/problems/combination-sum/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Combination-Sum.cpp) | | | Medium | |
2 | [Combination Sum - 2](https://practice.geeksforgeeks.org/problems/combination-sum-part-2/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Combination-Sum-2.cpp) | | | Medium | |
3 | [Solve the Sudoku](https://practice.geeksforgeeks.org/problems/solve-the-sudoku/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Solve-the-Sudoku.cpp) | _O(9^(n^2))_ | _O(n^2)_ | Hard | |## Dynamic Programming
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|
1 | [0 - 1 Knapsack Problem](https://practice.geeksforgeeks.org/problems/0-1-knapsack-problem/0) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/0-1-Knapsack-Problem.cpp) | _O(2^n)_ | _O(m*n)_ | Medium | |
2 | [House Robber](https://leetcode.com/problems/house-robber/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/House-Robber.cpp) | _O(n)_ | _O(n)_ | Easy | |
3 | [House Robber II](https://leetcode.com/problems/house-robber-ii/discuss/?currentPage=2&orderBy=hot&query=) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/House-Robber-II.cpp) | _O(n)_ | _O(n)_ | Medium | |
4 | [Partition Equal Subset Sum](https://leetcode.com/problems/partition-equal-subset-sum/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Partition-Equal-Subset-Sum.cpp) | _O(2^n)_ | _O(m*n)_ | Medium | |
5 | [Unique Paths II](https://leetcode.com/problems/unique-paths-ii/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Unique-Paths-2.cpp) |_O(m*n)_ | _O(1)_ | Medium | |
6 | [Target Sum](https://leetcode.com/problems/target-sum/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Target-Sum.cpp) |_O(2^n)_ | _O(m*n)_ | Medium | |
7 | [Longest Common Subsequence](https://leetcode.com/problems/longest-common-subsequence/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Longest-Common-Subsequence.cpp) | _O(2^n)_ | _O(m*n)_ | Medium | |
8 | [Longest Increasing Subsequence](https://leetcode.com/problems/longest-increasing-subsequence/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Longest-Increasing-Subsequence.cpp) |_O(n^2)_ | _O(n^2)_ | Medium | |
9 | [Longest Palindromic Substring](https://leetcode.com/problems/longest-palindromic-substring/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Longest-Palindromic-Substring.cpp) |_O(n^2)_ | _O(1)_ | Medium | |
10 | [Longest Palindromic Subsequence](https://leetcode.com/problems/longest-palindromic-subsequence/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Longest-Palindromic-Subsequence.cpp) |_O(n^2)_ | _O(n^2)_ | Medium | |
11 | [Minimum Insertion Steps to Make a String Palindrome](https://leetcode.com/problems/minimum-insertion-steps-to-make-a-string-palindrome/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Minimum-Insertion-Steps-to-Make-a-String-Palindrome.cpp) |_O(n^2)_ | _O(n^2)_ | Hard | |
12 | [Coin Change](https://leetcode.com/problems/coin-change/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Coin-Change.cpp) |_O(S*n)_ | _O(n)_ | Medium | |
13 | [Maximal Square](https://leetcode.com/problems/maximal-square/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Maximal-Square.cpp) | _O(n*m)_ | _O(n*m)_ | Medium | |
14 | [Best Time to Buy and Sell Stock](https://leetcode.com/problems/best-time-to-buy-and-sell-stock/) | [Solution](https://github.com/nkits9/GeeksForGeeks-Solved-Problems/blob/master/c%2B%2B/Best-Time-to-Buy-and-Sell-Stock.cpp) | _O(n)_ | _O(1)_ | Easy | Kadane's Algorithm |
15 | [Perfect Squares](https://leetcode.com/problems/perfect-squares/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Perfect-Squares.cpp) | _O(n*sqrt(n))_ | _O(1)_ | Medium | |
16 | [Word Break](https://leetcode.com/problems/word-break/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Word-Break.cpp) |_O(n^2)_ | _O(n)_ | Medium | |
17 | [Maximal Rectangle](https://leetcode.com/problems/maximal-rectangle/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Maximal-Rectangle.cpp) |_O(n^2)_ | _O(n)_ | Hard | |
18 | [Maximum Product Subarray](https://leetcode.com/problems/maximum-product-subarray/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Maximum-Product-Subarray.cpp) |_O(n)_ | _O(1)_ | Medium | |
19 | [Minimum Remove to Make Valid Parentheses](https://leetcode.com/problems/minimum-remove-to-make-valid-parentheses/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Minimum-Remove-to-Make-Valid-Parentheses.cpp) |_O(n)_ | _O(n)_ | Medium | |
20 | [Trapping Rain Water](https://leetcode.com/problems/trapping-rain-water/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Trapping-Rain-Water.cpp) |_O(n)_ | _O(n)_ | Hard | |
21 | [Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling/) | [Solution](https://github.com/nkits9/DSA-Solved-Problems/blob/master/c%2B%2B/Maximum-Profit-in-Job-Scheduling.cpp) |_O(n^2)_ | _O(n)_ | Hard | |## Bit Magic
| # | Title | Solution | Time | Space | Difficulty | Tag |
|-----|---------------- | --------------- | --------------- | --------------- | ------------- |--------------|## 🤝 Contributing
```bash
1. Fork the repository
2. Do the desired changes (add/delete/modify)
3. Make a pull request
```Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
## Author
👤 **Harshit Jain**
✉️ *[email protected]*
- Linkedin: [@harshit1202](https://www.linkedin.com/in/harshit1202/)
- Github: [@jharsh1202](http://github.com/jharsh1202)