Welcome to the Leetcode 250 repository β a curated collection of the 250 most frequently asked Leetcode questions with clean Python solutions, detailed explanations, and optimized code β ideal for preparing for FAANG, Big Tech, and startup coding interviews.
β If youβre searching for:
Leetcode 250Β·Top 250 Leetcode ProblemsΒ·FAANG Coding PrepΒ·Python Interview Questions
Most Asked Leetcode QuestionsΒ·Leetcode DSA SheetΒ·Leetcode for Big Tech Interviews
Data Structures and Algorithms in PythonΒ·Top Leetcode List 2024Β·Best Leetcode Questions to Practice
Leetcode Pattern-Based PracticeΒ·Python Coding Interview GuideΒ·Google Amazon Meta Interview Leetcode
Top DSA Problems for Product Based CompaniesΒ·Coding Round Preparation in Python
Neetcode 150 vs Leetcode 250Β·Leetcode Python TrackerΒ·Crack the Coding Interview with LeetcodeYouβve landed in the right place.
βοΈ 250 curated questions to maximize your DSA preparation
βοΈ Clean and readable Python solutions
βοΈ Includes intuition, approach, time/space complexity
βοΈ Structured by topic for ease of learning
βοΈ Suitable for Google, Amazon, Meta, Microsoft, Netflix
βοΈ Regular updates and daily commit logs
βοΈ Easy folder navigation and problem search
| π‘ Topic | π Folder Name | π Problem Count |
|---|---|---|
| Arrays & Strings | arrays_strings/ |
~40 problems |
| Linked Lists | linked_lists/ |
~20 problems |
| Trees & Binary Trees | trees/ |
~35 problems |
| Graphs & Traversals | graphs/ |
~25 problems |
| Dynamic Programming | dp/ |
~40 problems |
| Sliding Window | sliding_window/ |
~20 problems |
| Binary Search | binary_search/ |
~15 problems |
| Backtracking | backtracking/ |
~20 problems |
| Stack & Queues | stack_queue/ |
~15 problems |
| Heap & Greedy | heap_greedy/ |
~15 problems |
| Bit Manipulation | bit_manipulation/ |
~10 problems |
| Math & Logic | math_logic/ |
~10 problems |
| Others & Miscellaneous | others/ |
~5 problems |
π Detailed topic guide: See TOPICS.md for comprehensive explanations of each category.
π Progress Tracker
β Total Questions: 250
π Solved: XX
π Updates: Daily commits
π― Track your progress: Run
python progress_tracker.pyto monitor your completion status across all categories.
β Stars, forks, and contributions are welcome!
β Support & Share
If this project helps you:
π Give it a star
π΄ Fork it to your profile
π£οΈ Share with friends and aspiring interview candidates
"""
Problem: 121. Best Time to Buy and Sell Stock
Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
Level: Easy
Approach:
- Track the minimum price seen so far
- Track the maximum profit if sold today
Time Complexity: O(n)
Space Complexity: O(1)
"""
def maxProfit(prices):
min_price = float('inf')
max_profit = 0
for p in prices:
min_price = min(min_price, p)
max_profit = max(max_profit, p - min_price)
return max_profit