This repository contains my solutions to various LeetCode problems. Each problem is solved using three different approaches:
- Brute Force: A straightforward but possibly inefficient approach.
- Better Approach: A solution that improves on the brute force method.
- Optimal Approach: The most efficient solution in terms of time and space complexity.
The goal is to demonstrate progression from basic problem-solving strategies to the most optimized solutions.
Each problem has its own folder containing:
- Brute force solution (
brute_force.cpp
) - Better solution (
better_solution.cpp
) - Optimal solution (
optimal_solution.cpp
) - A README file with a description of the problem, solution explanation, and time/space complexities.
- Each folder corresponds to a specific LeetCode problem.
- In each folder, you’ll find three different solutions: brute force, better, and optimal.
- Each folder also contains a README with a description of the problem and solution explanations.
- Brute Force: Simple approach focusing on solving the problem, typically with higher time complexity.
- Better Solution: Optimizes either time or space complexity.
- Optimal Solution: Leverages advanced techniques like dynamic programming, greedy algorithms, or efficient data structures to achieve the best possible time and space complexity.
Contributions are welcome! Feel free to open issues or submit pull requests if you have better solutions or suggestions.