Skip to content

feat: add 5 more leetcode problems#175

Merged
wislertt merged 2 commits into
mainfrom
add-more-leetcode-problems
Jul 7, 2026
Merged

feat: add 5 more leetcode problems#175
wislertt merged 2 commits into
mainfrom
add-more-leetcode-problems

Conversation

@wislertt

@wislertt wislertt commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add 5 new LeetCode problems (9. Palindrome Number, 13. Roman to Integer, 14. Longest Common Prefix, 16. 3Sum Closest, 32. Longest Valid Parentheses) with JSON templates, generated scaffolds, and optimal solutions
  • Sync 22 pre-existing problems whose generated README.md/playground.py had drifted from the JSON source of truth
  • Update dependencies

Changes

1. Add 5 LeetCode problems

src/leetcode_py/cli/resources/leetcode/json/problems/{palindrome_number,roman_to_integer,longest_common_prefix,three_sum_closest,longest_valid_parentheses}.json + leetcode/<problem>/*

Each problem ships a JSON template (source of truth) plus the full generated scaffold — README.md, solution.py, helpers.py, test_solution.py, playground.py, __init__.py. Solutions implemented optimally:

  • 9. Palindrome Number (Easy) — reverse half the integer, O(log n) time / O(1) space, no string conversion
  • 13. Roman to Integer (Easy) — right-to-left scan subtracting smaller-before-larger symbols, O(n) / O(1)
  • 14. Longest Common Prefix (Easy) — vertical character scan across all strings, O(S) / O(1)
  • 16. 3Sum Closest (Medium) — sort + two-pointer nearest-sum, O(n²) / O(1)
  • 32. Longest Valid Parentheses (Hard) — index stack seeded with -1, O(n) / O(n)

tags.json5 registers all five under the grind tag (alphabetically sorted); bakefile.py problem field set to longest_valid_parentheses. Each problem has 16 parametrized test cases.

2. Sync drifted generated files

leetcode/{alien_dictionary,cheapest_flights_within_k_stops,counting_bits,evaluate_reverse_polish_notation,find_all_anagrams_in_a_string,house_robber,house_robber_ii,is_graph_bipartite,longest_substring_without_repeating_characters,lru_cache,majority_element,merge_triplets_to_form_target_triplet,n_queens,non_overlapping_intervals,number_of_provinces,single_number,single_number_iii,subarray_sum_equals_k,two_sum_ii_input_array_is_sorted,valid_anagram,valid_parenthesis_string,word_search_ii}/

Regenerated README.md and playground.py for 22 existing problems so they match the JSON templates. Drift was caused by an earlier generator change that stopped escaping * in constraint lines (e.g. 3 \* 10^43 * 10^4); valid_parenthesis_string also picked up a trailing-whitespace fix. solution.py is excluded from the consistency check and was restored untouched. bake check-consistency now passes.

3. Update dependencies

  • bakefile[lib] bumped >=0.0.8>=0.0.57a0 (prerelease)
    • pyproject.toml, uv.lock
  • Adds [tool.uv] index-strategy = "unsafe-best-match" / prerelease = "explicit" config and a test-pypi source for bakefile

Test plan

  • bake lint passes (ruff, ty, deptry, actionlint, sort_tags)
  • bake check-consistency passes — all generated files match JSON source of truth
  • bake p-test -p <each new problem> — 16/16 tests pass per problem

co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@wislertt wislertt marked this pull request as ready for review July 7, 2026 03:01
@wislertt wislertt merged commit 690cf52 into main Jul 7, 2026
27 checks passed
@wislertt wislertt deleted the add-more-leetcode-problems branch July 7, 2026 03:02
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 0.47.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant