An open API service indexing awesome lists of open source software.

https://github.com/belanasaikiran/leetcode75

My Implemenations for LeetCode 75
https://github.com/belanasaikiran/leetcode75

cplusplus leetcode

Last synced: about 1 month ago
JSON representation

My Implemenations for LeetCode 75

Awesome Lists containing this project

README

          

# LeetCode75 [🔗](https://leetcode.com/studyplan/leetcode-75/)

### Arrays/Strings
| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
| [Merge Strings Alternately](https://leetcode.com/problems/merge-strings-alternately) | Easy | [Solution](./StringsOrArrays/mergeStrings.cpp) | O(n) | O(1) |
| [Greatest Common Divisor of Strings](https://leetcode.com/problems/merge-strings-alternately) | Easy | [Solution](./StringsOrArrays/GreatestCommonDivisorofStrings.cpp) | O(m+n+logmin(m,n)) | O(m + n) |
| [Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies) | Easy | [solution](./StringsOrArrays/KidsWiththeGreatestNumberofCandies.cpp) | O(n) | O(1) |
|[Can Place Flowers](https://leetcode.com/problems/can-place-flowers/) | Easy | [Solution](./StringsOrArrays/CanPlaceFlowers.cpp) | O(n) | O(1) |
| [Reverse Vowels of a String](https://leetcode.com/problems/reverse-vowels-of-a-string) | Easy | [Solution](./StringsOrArrays/ReverseVowelsOfAString.cpp) | O(log n) | O(1) |
| [Reverse Words in a String](https://leetcode.com/problems/reverse-words-in-a-string) | Medium | [Solution](./StringsOrArrays/ReverseWordsInAString.cpp) | O(n) | O(n) |
|[Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self) | Medium | [Solution](./StringsOrArrays/ProductOfArrayExceptSelf.cpp) | O(n) | O(1) |
|[Increasing Triplet Subsequence](https://leetcode.com/problems/increasing-triplet-subsequence) | Medium | [Solution](./StringsOrArrays/IncreasingTripletSubsequence.cpp) | O(n) | O(1) |
|[String Compression](https://leetcode.com/problems/string-compression/) | Medium | [Solution](./StringsOrArrays//StringCompression.cpp) | O(n) | O(1) |

### Two Pointers

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
| [Move Zeroes](https://leetcode.com/problems/move-zeroes) | Easy | [Solution](./TwoPointers/MoveZeroes.cpp) | O(n) | O(1) |
| [Is Subsequence](https://leetcode.com/problems/is-subsequence) | Easy | [Solution](./TwoPointers/./IsSubsequence.cpp) | O(n) | O(1) |
|[Container With Most Water](https://leetcode.com/problems/container-with-most-water)| Medium | [Solution](./TwoPointers/ContainerWithMostWater.cpp) | O(n) | O(1) |
|[Max Number of K-Sum Pairs](https://leetcode.com/problems/max-number-of-k-sum-pairs)| Medium | [Solution](./TwoPointers/MaxNumberOfKSumPairs.cpp) | O(n log n) and O(n) | O(1) |

### Sliding Window

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Maximum Average Subarray I](https://leetcode.com/problems/maximum-average-subarray-i/)| Easy | [Solution](./SlidingWindow/MaximumAverageSubarrayI.cpp) | O(n) | O(1) |
|[Maximum Number of Vowels in a Substring of Given Length](https://leetcode.com/problems/maximum-number-of-vowels-in-a-substring-of-given-length/?envType=study-plan-v2&envId=leetcode-75)| Medium | [Solution](./SlidingWindow/Maximum%20Number%20of%20Vowels%20in%20a%20Substring%20of%20Given%20Length.cpp) | O(n) | O(1) |
|[Max Consecutive Ones III](https://leetcode.com/problems/max-consecutive-ones-iii)| Medium | [Solution](./SlidingWindow/Max%20Consecutive%20Ones%20III.cpp) | O(n) | O(1) |
|[Longest Subarray of 1's After Deleting One Element](https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element)| Medium | [Solution](./SlidingWindow/Longest%20Subarray%20of%201s%20After%20Deleting%20One%20Element.cpp) | O(n) | O(1) |

### Prefix Sum

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Find the Highest Altitude](https://leetcode.com/problems/find-the-highest-altitude)| Easy | [Solution](./PrefixSum/FindTheHighestAltitude.cpp) | O(n) | O(1) |
|[Find the Pivot Index](https://leetcode.com/problems/find-pivot-index)| Easy | [Solution](./PrefixSum/FindPivotIndex.cpp) | O(n) | O(1) |

### Hash Map / Set

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Find the Difference of Two Arrays](https://leetcode.com/problems/find-the-difference-of-two-arrays)| Easy | [Solution](./HashMapOrSet/FindTheDifferenceofTwoArrays.cpp) | O(n) | O(1) |
|[Unique Number of Occurrences](https://leetcode.com/problems/unique-number-of-occurrences)| Easy | [Solution](./HashMapOrSet/UniqueNumberOfOccurrences.cpp) | O(n) | O(1) |
|[Determine if Two Strings Are Close](https://leetcode.com/problems/determine-if-two-strings-are-close)| Medium | [Solution](./HashMapOrSet/DetermineIfTwoStringsAreClose.cpp) | O(n) | O(1) |
|[Equal Row and Column Pairs](https://leetcode.com/problems/equal-row-and-column-pairs)| Medium | [Solution](./HashMapOrSet/EqualRowAndColumnPairs.cpp) | O(n) | O(1) |

### Stacks

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Removing Stars From a String](https://leetcode.com/problems/removing-stars-from-a-string)| Medium | [Solution](./Stack/RemovingStarsFromAString.cpp) | O(n) | O(1) |
|[Asteroid Collision](https://leetcode.com/problems/asteroid-collision)| Medium | [Solution](./Stack/AsteroidCollision.cpp) | O(n) | O(1) |
|[Decode String](https://leetcode.com/problems/decode-string)| Medium | [Solution](./Stack/DecodeString.cpp) | O(n) | O(n) |

### Queues

| Problem | Difficulty | | Time Complexity | Space Complexity | Visit Again |
| --------| :-------- |---------| :-------------: | :--------------: | :-----: |
|[Number of Recent Calls](https://leetcode.com/problems/number-of-recent-calls)| Easy | [Solution](./Queues/number-of-recent-calls.cpp) | O(1) | O(1) |
|[Dota 2 Senate ](https://leetcode.com/problems/dota2-senate)| Medium | [Solution](./Queues/dota2-senate.cpp) | O(n) | O(1) | Must Redo |

### Linked Lists

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Delete the Middle Node of a Linked List](https://leetcode.com/problems/delete-the-middle-node-of-a-linked-list)| Medium | [Solution](./LInkedList/delete-the-middle-node-of-a-linked-list.cpp) | O(log n) | O(1) |
|[Odd Even Linked List](https://leetcode.com/problems/odd-even-linked-list)| Medium | [Solution](./LInkedList/delete-the-middle-node-of-a-linked-list.cpp) | O(log n) | O(1) |
|[ Reverse Linked List](https://leetcode.com/problems/reverse-linked-list)| Easy | [Solution](./LInkedList/reverse-linked-list.cpp) | O(n) | O(1) |
|[Maximum Twin Sum of a Linked List](https://leetcode.com/problems/maximum-twin-sum-of-a-linked-list)| Medium | [Solution](./LInkedList/maximum-twin-sum-of-a-linked-list.cpp) | O(n) | O(1) |

### Binary Tree (DFS)

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Maximum Depth of Binary Tree](https://leetcode.com/problems/maximum-depth-of-binary-tree)| Easy | [Solution](./BinaryTrees/maximum-depth-of-binary-tree.cpp) | O(n) | O(1) |
|[Leaf Similar Trees](https://leetcode.com/problems/leaf-similar-trees/)| Easy | [Solution](./BinaryTrees/leaf-similar-trees.cpp) | O(n) | O(n) |
|[Count Good Nodes in Binary Tree](https://leetcode.com/problems/count-good-nodes-in-binary-tree)| Medium | [Solution](./BinaryTrees/count-good-nodes-in-binary-tree.cpp) | O(n) | O(1) |
|[Path Sum III](https://leetcode.com/problems/path-sum-iii)| Medium | [Solution](./BinaryTrees/path-sum-iii.cpp) | O(n) | O(n) |
|[Longest ZigZag Path in a Binary Tree](https://leetcode.com/problems/longest-zigzag-path-in-a-binary-tree)| Medium | [Solution](./BinaryTrees/longest-zigzag-path-in-a-binary-tree.cpp) | O(n) | O(n) |
|[Lowest Common Ancestor of a Binary Tree](https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree)| Medium | [Solution](./BinaryTrees/lowest-common-ancestor-of-a-binary-tree.cpp) | O(n) | O(n) |

### Binary Tree (BFS)

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Binary Tree Right Side View](https://leetcode.com/problems/binary-tree-right-side-view)| Medium | [Solution](./BinaryTrees/binary-tree-right-side-view.cpp) | O(n) | O(1) |
|[Maximum Level Sum of a Binary Tree](https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree)| Medium | [Solution](./BinaryTrees/maximum-level-sum-of-a-binary-tree.cpp) | O(n) | O(1) |

### Binary Search Tree

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Search in a Binary Search Tree](https://leetcode.com/problems/search-in-a-binary-search-tree)| Easy | [Solution](./BST/search-in-a-binary-search-tree.cpp) | O(n) | O(1)
|[Delete Node in a BST](https://leetcode.com/problems/delete-node-in-a-bst)| Medium | [Solution](./BST/delete-node-in-a-bst.cpp) | O(n) | O(1)

### Graphs - DFS

I need to re-do this. Too confusing. Maybe redo and understand how to solve these

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Keys and Rooms](https://leetcode.com/problems/keys-and-rooms)| Medium | [Solution](./Graphs/keys-and-rooms.cpp) | O(n) | O(n)
|[Number of Provinces](https://leetcode.com/problems/number-of-provinces)| Medium | [Solution](./Graphs/number-of-provinces.cpp) | O(n) | O(n)
|[Reorder Routes to Make All Paths Lead to the City Zero](https://leetcode.com/problems/reorder-routes-to-make-all-paths-lead-to-the-city-zero)| Medium | [Solution](./Graphs/reorder-routes-to-make-all-paths-lead-to-the-city-zero.cpp) | O(n) | O(n)
|[Evaluate Division](https://leetcode.com/problems/evaluate-division)| Medium | [Solution](./Graphs/evaluate-division.cpp) | O(n) | O(n)

### Graphs - BFS

| Problem | Difficulty | | Time Complexity | Space Complexity |
| --------| :-------- |---------| :-------------: | :--------------: |
|[Nearest Exit from Entrance in Maze](https://leetcode.com/problems/nearest-exit-from-entrance-in-maze)| Medium | [Solution](./Graphs/nearest-exit-from-entrance-in-maze.cpp) | O(m x n) | O(m x n)
|[Rotting Oranges](https://leetcode.com/problems/rotting-oranges)| Medium | [Solution](./Graphs/rotting-oranges.cpp) | O(m x n) | O(m x n)