StepanTita / interview-prep

This repository contains C++ solutions for various LeetCode problems, categorized into multiple sections by topics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LeetCode Problem Solutions in C++

Welcome to my LeetCode problem solutions repository! ๐Ÿ‘‹ Here, you'll find C++ solutions to a variety of interesting problems across different categories. Feel free to explore and learn from these solutions as you tackle your own LeetCode challenges. If you find this repository helpful, please consider giving it a โญ๏ธ!

Problems

Binary Search ๐Ÿ”:

  1. Search Insert Position
  2. Search a 2D Matrix
  3. Search a 2D Matrix II
  4. Find Peak Element
  5. Search in Rotated Sorted Array
  6. Find First and Last Position of Element in Sorted Array
  7. Find Minimum in Rotated Sorted Array
  8. Median of Two Sorted Arrays
  9. Ways to Split Array Into Three Subarrays

Dynamic Programming ๐Ÿงฎ:

  1. Climbing Stairs
  2. House Robber
  3. Word Break
  4. All Possible Full Binary Trees
  5. Get Maximum in Generated Array
  6. N-th Tribonacci Number
  7. Longest Increasing Subsequence
  8. Coin Change
  9. Partition Array for Maximum Sum
  10. Egg Drop With 2 Eggs and N Floors
  11. Count Substrings That Differ by One Character
  12. Fair Distribution of Cookies
  13. Stone Game II
  14. Palindromic Substrings
  15. Longest ZigZag Path in a Binary Tree
  16. Longest Subarray of 1's After Deleting One Element
  17. Palindrome Partitioning
  18. Minimum Path Cost in a Grid
  19. Minimum Falling Path Sum
  20. Minimum Cost For Tickets
  21. Arithmetic Slices
  22. Minimum ASCII Delete Sum for Two Strings
  23. Minimum ASCII Delete Sum for Two Strings
  24. Beautiful Arrangement Solution
  25. Ways to Make a Fair Array
  26. Uncrossed Lines
  27. Longest Palindromic Subsequence
  28. Maximum Compatibility Score Sum
  29. Flip String to Monotone Increasing Solution
  30. Different Ways to Add Parentheses Solution
  31. Delete Operation for Two Strings
  32. Longest String Chain
  33. Unique Binary Search Trees
  34. Integer Break
  35. Maximum Sum of Two Non-Overlapping Subarrays
  36. Filling Bookcase Shelves
  37. Best Sightseeing Pair
  38. Maximum Alternating Subsequence Sum
  39. Maximum Absolute Sum of Any Subarray
  40. Minimum Deletions to Make String Balanced
  41. Number of Smooth Descent Periods of a Stock
  42. Make Costs of Paths Equal in a Binary Tree
  43. Find the City With the Smallest Number of Neighbors at a Threshold Distance
  44. Stone Game VII
  45. Longest Common Subsequence
  46. Shortest Common Supersequence
  47. Best Time to Buy and Sell Stock
  48. Best Time to Buy and Sell Stock II
  49. Best Time to Buy and Sell Stock with Cooldown
  50. Best Time to Buy and Sell Stock III
  51. Best Time to Buy and Sell Stock IV
  52. Edit Distance
  53. Find the Substring With Maximum Cost
  54. Unique Binary Search Trees II
  55. Delete and Earn
  56. Predict the Winner
  57. Count Ways To Build Good Strings
  58. Solving Questions With Brainpower
  59. Last Stone Weight II
  60. Vowels of All Substrings
  61. House Robber III
  62. House Robber II
  63. Combination Sum IV
  64. Largest Sum of Averages
  65. Jump Game
  66. Interleaving String
  67. Jump Game VI
  68. Binary Trees With Factors
  69. Extra Characters in a String
  70. Partition String Into Minimum Beautiful Substrings
  71. Domino and Tromino Tiling
  72. Video Stitching
  73. Maximum Length of Repeated Subarray
  74. Greatest Sum Divisible by Three

Heap ๐Ÿ“Š:

  1. Kth Largest Element in an Array
  2. IPO
  3. Find K Pairs with Smallest Sums
  4. Find Median from Data Stream
  5. Minimum Cost to Hire K Workers
  6. Find the Kth Smallest Sum of a Matrix With Sorted Rows
  7. Sliding Window Maximum

Stack ๐Ÿ“ฅ:

  1. Largest Rectangle in Histogram
  2. Count Submatrices With All Ones

Greedy ๐Ÿ’ฐ:

  1. Longest Unequal Adjacent Groups Subsequence I
  2. Largest Values From Labels
  3. Reducing Dishes

BFS & DFS ๐Ÿ”:

  1. Push Dominoes
  2. K-Similar Strings
  3. Recover a Tree From Preorder Traversal
  4. As Far from Land as Possible

Math โ™พ๏ธ:

  1. Maximum of Absolute Value Expression

Data Structures ๐Ÿ—„๏ธ:

  1. Insert Delete GetRandom O(1)

LinkedLists ๐Ÿšˆ:

  1. Remove Nth Node From End of List

Graphs:

  1. Evaluate Division
  2. All Elements in Two Binary Search Trees
  3. Course Schedule
  4. Course Schedule II
  5. Binary Tree Maximum Path Sum
  6. Cheapest Flights Within K Stops
  7. Binary Tree Coloring Game

Arrays ๐ŸŽž:

  1. Number of Ways to Split Array
  2. Sort Array By Parity II
  3. Distance Between Bus Stops
  4. Find the Highest Altitude

Other:

  1. Toeplitz Matrix
  2. Bulls and Cows
  3. Brace Expansion II Solution
  4. Unique Paths III
  5. Max Increase to Keep City Skyline
  6. Set Matrix Zeroes ๐Ÿคข (genuinely hate this problem)
  7. Battleships in a Board
  8. Binary String With Substrings Representing 1 To N
  9. Candy
  10. Restore IP Addresses
  11. Minimum Time to Make Rope Colorful
  12. Pow(x, n)
  13. Partition Array into Disjoint Intervals
  14. Brick Wall
  15. Array Nesting
  16. Minimum Number of Steps to Make Two Strings Anagram II
  17. Remove Letter To Equalize Frequency
  18. Find the Town Judge
  19. Shopping Offers
  20. Check if There is a Valid Partition For The Array
  21. Number of Matching Subsequences

Happy coding! If you have any questions or suggestions, feel free to open an issue or create a pull request.

๐Ÿš€ Happy Learning! ๐Ÿš€

About

This repository contains C++ solutions for various LeetCode problems, categorized into multiple sections by topics


Languages

Language:C++ 98.8%Language:Python 1.2%