Skip to content

Add eleven LeetCode-style problems - #79

Merged
naman0r merged 1 commit into
mainfrom
add-eleven-problems
Oct 10, 2026
Merged

naman0r merged 1 commit into
mainfrom
add-eleven-problems

Conversation

@naman0r

@naman0r naman0r commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

What and why

Adds eleven problems, each as one V<n>__add_<slug>.sql migration (V15 to V25) and a reference solution in apps/backend/tests/solutions/:

  • Minimum Penalty for a Shop (medium)
  • Parallel Courses III (hard)
  • One Edit Distance (medium)
  • Cheapest Flights Within K Stops (medium)
  • Calculate Amount Paid in Taxes (easy)
  • Number of Black Blocks (medium)
  • Alert Using Same Key-Card Three or More Times in a One Hour Period (medium)
  • Brace Expansion (medium)
  • Invalid Transactions (medium)
  • Simple Bank System (medium)
  • Next Permutation (medium)

All are from LeetCode, with the statements written fresh. Merge Intervals was on the same list but already exists, so it is not here.

Simple Bank System is a design problem, so its starter is a Bank class with four methods and a harness that runs one operation per input line. test_problems.py now accepts class Bank in a starter, as it already did class Codec.

This is one pull request rather than one per problem as CONTRIBUTING.md asks, since they were added together.

How this was verified

  • make test: 163 passed, 5 skipped (sandbox). That includes the reference solution and the migration shape check for each new problem.
  • The visible examples match LeetCode's examples. Every expected output was produced by the reference solution and checked against a separate brute-force implementation. The untouched starter fails each problem.
  • Ran the stack locally and confirmed all 26 problems were in the database after migrating. I did not solve a problem through the UI.
  • None of the new problems set up complexity analysis.

Docs

None needed.

Summary by CodeRabbit

  • New Features
    • Added 11 coding challenges covering shop closing times, course scheduling, string editing, flight routes, tax calculations, grid patterns, key-card alerts, brace expansion, transaction validation, banking operations, and permutations.
    • Added problem-specific examples and test cases, with Python starter templates for learners to complete.
    • Added working reference solutions for the new challenges.

Minimum Penalty for a Shop, Parallel Courses III, One Edit Distance,
Cheapest Flights Within K Stops, Calculate Amount Paid in Taxes, Number of
Black Blocks, Alert Using Same Key-Card Three or More Times in a One Hour
Period, Brace Expansion, Invalid Transactions, Simple Bank System and Next
Permutation, each as one migration and a reference solution.

Simple Bank System is a design problem, so its starter is a Bank class, and
the starter check accepts it alongside Solution and Codec.
@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
tandemcode Ready Ready Preview Oct 10, 2026 1:08am UTC

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f93419ad-2e50-47dd-8960-0ee98b24ab5f

📥 Commits

Reviewing files that changed from the base of the PR and between 14fe8b4 and c3e79f2.


📒 Files selected for processing (23)
  • apps/backend/migrations/V15__add_minimum_penalty_for_a_shop.sql
  • apps/backend/migrations/V16__add_parallel_courses_iii.sql
  • apps/backend/migrations/V17__add_one_edit_distance.sql
  • apps/backend/migrations/V18__add_cheapest_flights_within_k_stops.sql
  • apps/backend/migrations/V19__add_calculate_amount_paid_in_taxes.sql
  • apps/backend/migrations/V20__add_number_of_black_blocks.sql
  • apps/backend/migrations/V21__add_alert_using_same_key_card_three_or_more_times_in_a_one_hour_period.sql
  • apps/backend/migrations/V22__add_brace_expansion.sql
  • apps/backend/migrations/V23__add_invalid_transactions.sql
  • apps/backend/migrations/V24__add_simple_bank_system.sql
  • apps/backend/migrations/V25__add_next_permutation.sql
  • apps/backend/tests/solutions/alert-using-same-key-card-three-or-more-times-in-a-one-hour-period.py
  • apps/backend/tests/solutions/brace-expansion.py
  • apps/backend/tests/solutions/calculate-amount-paid-in-taxes.py
  • apps/backend/tests/solutions/cheapest-flights-within-k-stops.py
  • apps/backend/tests/solutions/invalid-transactions.py
  • apps/backend/tests/solutions/minimum-penalty-for-a-shop.py
  • apps/backend/tests/solutions/next-permutation.py
  • apps/backend/tests/solutions/number-of-black-blocks.py
  • apps/backend/tests/solutions/one-edit-distance.py
  • apps/backend/tests/solutions/parallel-courses-iii.py
  • apps/backend/tests/solutions/simple-bank-system.py
  • apps/backend/tests/test_problems.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The pull request adds eleven coding problem records, Python starter scaffolds, and test cases. It also adds reference implementations and command-line runners for all eleven problems. Starter-code validation now accepts a Bank class.

Changes

Problem catalog additions

Layer / File(s) Summary
Problem records and starter scaffolds
apps/backend/migrations/V15__*.sql–V25__*.sql
Migrations add eleven problem records with statements, Python starter code, input/output harnesses, and test cases.
Algorithm reference solutions
apps/backend/tests/solutions/*
Ten Python scripts implement problem methods and provide stdin/stdout runners.
Bank operations and starter validation
apps/backend/tests/solutions/simple-bank-system.py, apps/backend/tests/test_problems.py
The Bank class implements deposit, withdrawal, and transfer operations. The starter-code test accepts Bank as an alternative to Solution or Codec.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature


Merge Risk: ⚪ Minimal · up to c3e79

No confirmed issue prevents merging after normal checks.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely summarizes the main change: adding eleven LeetCode-style problems.
Docstring Coverage Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 12 files. (11 skipped: …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@naman0r
naman0r merged commit ee8c75f into main Oct 10, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — c3e79f26 Deployed Oct 10, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant