/Leetcode

Leetcode solutions in C++, C#, Python, Java, Scala, JS, Kotlin, Go, etc

Primary LanguageKotlin

LeetCode

https://leetcode.com

July LeetCoding Challenge

Click here for problem descriptions.

Solutions in various programming languages are provided. Enjoy it.

  1. Arranging Coins: Maths
  2. Binary Tree Level Order Traversal II: DFS
  3. Prison Cells After N Days: Maths
  4. Ugly Number II: DP
  5. Hamming Distance: Bitwise Manipulation
  6. Plus One: Maths
  7. Island Perimeter: BFS
  8. 3Sum: Two pointers
  9. Maximum Width of Binary Tree: DFS
  10. Flatten a Multilevel Doubly Linked List: Queue
  11. Subsets: DP
  12. Reverse Bits: Bitwise
  13. Same Tree: DFS
  14. Angle Between Hands of a Clock: Math

June LeetCoding Challenge

Click here for problem descriptions.

Solutions in various programming languages are provided. Enjoy it.

  1. Invert Binary Tree: Tree Traversal
  2. Delete Node in a Linked List: Linked List
  3. Two City Scheduling: DP
  4. Reverse String: String
  5. Random Pick With Weight: Binary Search + Probability
  6. Queue Reconstruction by Height: Greedy
  7. Coin Change 2: DP
  8. Power of Two: Bitwise manipulation
  9. Is Subsequence: Two pointers / DP
  10. Search Insert Position: Binary Search
  11. Sort Colors: Two Pointers
  12. Insert Delete GetRandom: Hash Table
  13. Largest Divisible Subset: DP
  14. Cheapest Flights Within K Stops: DP
  15. Search in a Binary Search Tree: Recursive
  16. Validate IP Address: String
  17. Surrounded Regions: BFS
  18. H Index II: Binary Search
  19. Longest Duplicate Substring:
  20. Permutation Sequence: Maths
  21. Dungeon Game: DP
  22. Single Number II: Bitwise Manipulation
  23. Count Complete Tree Nodes: Tree Traversal
  24. Unique Binary Search Trees: DP
  25. Find the Duplicate Number: Cycle Detect
  26. Sum Root To Leaf Numbers: DFS
  27. Perfect Squares: DP
  28. Reconstruct Itinerary: DFS
  29. Unique Paths: DP
  30. Word Search: Trie + DFS

May LeetCoding Challenge

Click here for problem descriptions.

Solutions in various programming languages are provided. Enjoy it.

  1. First Bad String: Binary search.
  2. Jewels and Stones: Hash Table
  3. Ransom Note: Hash Table
  4. Number Complement: Bitwise Manipulation
  5. First Unique Character In a String: Hash Table
  6. Majority Element: Ad hoc
  7. Cousins in Binary Tree: BFS / Recursion
  8. Check if it is straight line: Cross Product
  9. Valid Perfect Square: Math
  10. Find the Town Judge: Graph Theory
  11. Flood Fill: BFS
  12. Single Element In a Sorted Array: Binary Search
  13. Remove K Digits: Greedy
  14. Implement Trie: Trie
  15. Maximum Sum Circular Subarray: DP
  16. Odd Even Linked List: Linked List
  17. Find All Anagrams in a String: Sliding window + Hash Table
  18. Permutation In String: Sliding window + Hash Table
  19. Online Stock Span: DP
  20. Kth-Smallest-Element-In-A-BST: BST
  21. Count Square Submatrices with All Ones: DP
  22. Sort Characters By Frequency: Hash Table
  23. Interval List Intersections: Two Pointers
  24. Construct Binary Search Tree from Preorder Traversal: Binary Search Tree
  25. Uncrossed Lines: DP
  26. Contiguous Array: Hash Table
  27. Possible Bipartition: Bipartite Graph
  28. Counting Bits: Math
  29. Course Schedule: Topological Sort
  30. K Closest Points to Origin: Priority_queue, Sort
  31. Edit Distance: DP

30-Day (April) LeetCoding Challenge

Click here for problem descriptions.

  1. Single Number: Bitwise Manipulation
  2. Happy Number: Implementation
  3. Maximum Subarray: DP
  4. Move Zeros: Two pointers
  5. Best Time to Buy and Sell Stock II: Greedy
  6. Group Anagrams: Hash Table