Skip to content

Commit 5e2540d

Browse files
authored
feat: add 2 more leetcode problems (#63)
- add 2 more leetcode problems - update READEME and docs about available problem tags inlcuding blind-75, neetcode-150, algo-master-75 - update deps
1 parent 30c09b1 commit 5e2540d

File tree

21 files changed

+563
-102
lines changed

21 files changed

+563
-102
lines changed

.amazonq/rules/problem-creation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,4 +329,4 @@ make lint
329329

330330
## Tags (Optional)
331331

332-
Common tags: `["grind-75", "blind-75", "neetcode-150", "top-interview"]`
332+
Common tags: `["grind-75", "grind", "blind-75", "neetcode-150", "algo-master-75"]`

.github/workflows/ci-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919

2020
steps:
2121
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
22+
with:
23+
fetch-depth: 0
2224

2325
- name: Set up Python
2426
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PYTHON_VERSION = 3.13
2-
PROBLEM ?= alien_dictionary
2+
PROBLEM ?= jump_game
33
FORCE ?= 0
44
COMMA := ,
55

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,17 @@ A Python package to generate professional LeetCode practice environments. Featur
3838

3939
## <a id="whats-included"></a>🎯 What's Included
4040

41-
**Current**: All 75 problems from [Grind 75](https://www.techinterviewhandbook.org/grind75/) - the most essential coding interview questions curated by the creator of Blind 75.
41+
**Current Problem Sets**:
4242

43-
**Future**: Planned expansion to all free Grind problems for comprehensive interview preparation. [Contributions welcome!](CONTRIBUTING.md)
43+
- **grind-75** (75 problems) - Essential coding interview questions from [Grind 75](https://www.techinterviewhandbook.org/grind75/) ✅ Complete
44+
- **grind** (100+ problems) - Extended Grind collection including all Grind 75 plus additional problems 🚧 Partial
45+
- **blind-75** (75 problems) - Original [Blind 75](https://leetcode.com/problem-list/xi4ci4ig/) curated list 🚧 Partial
46+
- **neetcode-150** (150+ problems) - Comprehensive [NeetCode 150](https://neetcode.io/practice) problem set 🚧 Partial
47+
- **algo-master-75** (75 problems) - Curated algorithmic mastery problems 🚧 Partial
48+
49+
**Coverage**: 100+ unique problems across all major coding interview topics and difficulty levels.
50+
51+
**Note**: Some problem sets are partially covered. We're actively working to complete all collections. [Contributions welcome!](https://github.com/wisarootl/leetcode-py/blob/main/CONTRIBUTING.md)
4452

4553
## <a id="quick-start"></a>🚀 Quick Start
4654

@@ -56,7 +64,9 @@ pip install leetcode-py-sdk
5664
# Generate problems anywhere
5765
lcpy gen -n 1 # Generate Two Sum
5866
lcpy gen -t grind-75 # Generate all Grind 75 problems
59-
lcpy list -t grind-75 # List available problems
67+
lcpy gen -t neetcode-150 # Generate NeetCode 150 problems
68+
lcpy list -t grind-75 # List Grind 75 problems
69+
lcpy list -t blind-75 # List Blind 75 problems
6070

6171
# Start practicing
6272
cd leetcode/two_sum
@@ -67,7 +77,9 @@ python -m pytest test_solution.py # Run tests
6777
### Bulk Generation Example
6878

6979
```bash
70-
lcpy gen --problem-tag grind-75 --output leetcode # Generate all Grind 75 problems
80+
lcpy gen --problem-tag grind-75 --output leetcode # Generate all Grind 75 problems
81+
lcpy gen --problem-tag neetcode-150 --output leetcode # Generate NeetCode 150 problems
82+
lcpy gen --problem-tag blind-75 --output leetcode # Generate Blind 75 problems
7183
```
7284

7385
![Problem Generation](https://raw.githubusercontent.com/wisarootl/leetcode-py/main/docs/images/problems-generation.png)
@@ -256,14 +268,17 @@ poetry run python -m leetcode_py.tools.check_test_cases --threshold=10
256268
lcpy gen -n 1 # Single problem by number
257269
lcpy gen -s two-sum # Single problem by slug
258270
lcpy gen -t grind-75 # Bulk generation by tag
271+
lcpy gen -t neetcode-150 # Generate NeetCode 150 problems
259272
lcpy gen -n 1 -n 2 -n 3 # Multiple problems
260273
lcpy gen -t grind-75 -d Easy # Filter by difficulty
261274
lcpy gen -n 1 -o my-problems # Custom output directory
262275

263276
# List problems
264277
lcpy list # All available problems
265-
lcpy list -t grind-75 # Filter by tag
266-
lcpy list -d Medium # Filter by difficulty
278+
lcpy list -t grind-75 # Filter by Grind 75 tag
279+
lcpy list -t blind-75 # Filter by Blind 75 tag
280+
lcpy list -t neetcode-150 # Filter by NeetCode 150 tag
281+
lcpy list -d Medium # Filter by difficulty
267282

268283
# Scrape problem data
269284
lcpy scrape -n 1 # Fetch by number

docs/cli-usage.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,16 @@ lcpy list
143143

144144
# Filter by tag
145145
lcpy list -t grind-75
146+
lcpy list -t blind-75
147+
lcpy list -t neetcode-150
148+
lcpy list -t algo-master-75
146149

147150
# Filter by difficulty
148151
lcpy list -d Easy
149152

150153
# Combine filters
151154
lcpy list -t grind-75 -d Medium
155+
lcpy list -t neetcode-150 -d Hard
152156
```
153157

154158
## Problem Structure
@@ -181,8 +185,13 @@ _Comprehensive parametrized tests with 10+ test cases - executable and debuggabl
181185

182186
Available tags for bulk operations:
183187

184-
- `grind-75` - Essential 75 coding interview problems
185-
- `grind` - Original Blind 75 problems
188+
- `grind-75` - Essential 75 coding interview problems from [Grind 75](https://www.techinterviewhandbook.org/grind75/) ✅ Complete
189+
- `grind` - Extended Grind collection (100+ problems) including all Grind 75 plus additional problems 🚧 Partial
190+
- `blind-75` - Original [Blind 75](https://leetcode.com/discuss/general-discussion/460599/blind-75-leetcode-questions) curated list 🚧 Partial
191+
- `neetcode-150` - Comprehensive [NeetCode 150](https://neetcode.io/practice) problem set (150+ problems) 🚧 Partial
192+
- `algo-master-75` - Curated algorithmic mastery problems (75 problems) 🚧 Partial
193+
194+
**Note**: Some problem sets are partially covered. We're actively working to complete all collections. [Contributions welcome!](https://github.com/wisarootl/leetcode-py/blob/main/CONTRIBUTING.md)
186195

187196
## Output Directory
188197

leetcode/jump_game/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Jump Game
2+
3+
**Difficulty:** Medium
4+
**Topics:** Array, Dynamic Programming, Greedy
5+
**Tags:** blind-75
6+
7+
**LeetCode:** [Problem 55](https://leetcode.com/problems/jump-game/description/)
8+
9+
## Problem Description
10+
11+
You are given an integer array `nums`. You are initially positioned at the array's **first index**, and each element in the array represents your maximum jump length at that position.
12+
13+
Return `true` _if you can reach the last index, or_ `false` _otherwise_.
14+
15+
## Examples
16+
17+
### Example 1:
18+
19+
```
20+
Input: nums = [2,3,1,1,4]
21+
Output: true
22+
Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.
23+
```
24+
25+
### Example 2:
26+
27+
```
28+
Input: nums = [3,2,1,0,4]
29+
Output: false
30+
Explanation: You will always arrive at index 3 no matter what. Its maximum jump length is 0, which makes it impossible to reach the last index.
31+
```
32+
33+
## Constraints
34+
35+
- `1 <= nums.length <= 10^4`
36+
- `0 <= nums[i] <= 10^5`

leetcode/jump_game/__init__.py

Whitespace-only changes.

leetcode/jump_game/helpers.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def run_can_jump(solution_class: type, nums: list[int]):
2+
implementation = solution_class()
3+
return implementation.can_jump(nums)
4+
5+
6+
def assert_can_jump(result: bool, expected: bool) -> bool:
7+
assert result == expected
8+
return True

leetcode/jump_game/playground.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# ---
2+
# jupyter:
3+
# jupytext:
4+
# text_representation:
5+
# extension: .py
6+
# format_name: percent
7+
# format_version: '1.3'
8+
# jupytext_version: 1.17.3
9+
# kernelspec:
10+
# display_name: leetcode-py-py3.13
11+
# language: python
12+
# name: python3
13+
# ---
14+
15+
# %%
16+
from helpers import assert_can_jump, run_can_jump
17+
from solution import Solution
18+
19+
# %%
20+
# Example test case
21+
nums = [2, 3, 1, 1, 4]
22+
expected = True
23+
24+
# %%
25+
result = run_can_jump(Solution, nums)
26+
result
27+
28+
# %%
29+
assert_can_jump(result, expected)

leetcode/jump_game/solution.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
3+
# Time: O(n)
4+
# Space: O(1)
5+
def can_jump(self, nums: list[int]) -> bool:
6+
max_reach = 0
7+
for i, jump in enumerate(nums):
8+
if i > max_reach:
9+
return False
10+
max_reach = max(max_reach, i + jump)
11+
return True

0 commit comments

Comments
 (0)