Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d329ec4

Browse files
Update README.md
1 parent 206cc37 commit d329ec4

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

‎README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,51 @@ This repo contains **Python solutions** for the top 250 most frequently asked **
4141
> Solved: ✅ XX
4242
> Remaining: 🔄 XX
4343
44+
## 📘 Folder Structure
45+
46+
Leetcode-250/
47+
48+
├── Arrays/
49+
│ ├── 1_Two_Sum.py
50+
│ └── 121_Best_Time_to_Buy_and_Sell_Stock.py
51+
52+
├── DP/
53+
│ └── 70_Climbing_Stairs.py
54+
55+
├── Trees/
56+
│ └── 94_Binary_Tree_Inorder_Traversal.py
57+
58+
├── README.md
59+
60+
python
61+
Copy
62+
Edit
63+
64+
---
65+
66+
## 🧠 Example Format for Each Solution
67+
68+
```python
69+
"""
70+
Problem: 121. Best Time to Buy and Sell Stock
71+
Link: https://leetcode.com/problems/best-time-to-buy-and-sell-stock/
72+
Level: Easy
73+
74+
Approach:
75+
- Track the minimum price seen so far
76+
- Track the maximum profit if sold today
77+
78+
Time Complexity: O(n)
79+
Space Complexity: O(1)
80+
"""
81+
82+
def maxProfit(prices):
83+
min_price = float('inf')
84+
max_profit = 0
85+
for p in prices:
86+
min_price = min(min_price, p)
87+
max_profit = max(max_profit, p - min_price)
88+
return max_profit
4489
Update: Daily commits on problem-solving
4590

4691
---

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /