Skip to content

About

This repo where I start my journey solving LeetCode Contests from the very first contest on the platform.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LeetCode Contests

CI

Solutions from my journey through LeetCode contests, starting from the earliest ones on the platform.

Layout

Warm Up Contest/            # contest solutions (LeetCode-style Solution class)
Weekly Contest 509/
tests/                      # harnesses + expected-output cases
  common.hpp
  warm-up-contest/
  weekly-contest-509/
scripts/
  test_local.sh             # local runner (filter by contest / question)
  run_tests.sh              # CI runner (all suites)
  lib/test_common.sh        # shared compile/run helpers
.github/workflows/ci.yml

Solution files stay paste-ready for LeetCode: a Solution class only (no main, no includes). Each problem’s tests live under tests/ and #include the solution file.

Run tests locally

Requires g++ with C++17 support. Prefer test_local.sh on Windows/Git Bash (it fixes MinGW PATH clashes).

# All contests
bash scripts/test_local.sh

# One contest
bash scripts/test_local.sh --contest weekly-contest-509

# One question (contest required)
bash scripts/test_local.sh --contest weekly-contest-509 --question Q1
bash scripts/test_local.sh -c warm-up-contest -q 2

# Discover slugs
bash scripts/test_local.sh --list
bash scripts/test_local.sh -c weekly-contest-509 --list
Flags What runs
(none) every suite under tests/
--contest NAME all questions in that contest
--contest NAME --question Q that single suite
--question alone error

Binaries go to build/tests/. Contest names are the folder slugs under tests/ (e.g. warm-up-contest).

Add tests for a new problem

  1. Add the solution as usual, e.g. Weekly Contest 509/Q3.cpp.
  2. Create a matching harness, e.g. tests/weekly-contest-509/Q3.test.cpp:
#include "../common.hpp"
#include "../../Weekly Contest 509/Q3.cpp"

int main() {
    cout << "Weekly Contest 509 / Q3 — yourMethod\n";
    Solution sol;

    expect_eq(sol.yourMethod(/* args */), /* expected */, "case name");

    return summarize("Weekly Contest 509 / Q3");
}
  1. Run bash scripts/test_local.sh -c weekly-contest-509 -q Q3 and confirm it passes.

CI

Every push and pull request runs bash scripts/run_tests.sh (full suite) on GitHub Actions. A failing case or compile error fails the job.

About

This repo where I start my journey solving LeetCode Contests from the very first contest on the platform.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages