Personal C++20 solutions to a small selection of algorithm exercises, with one GoogleTest executable per solution.
| Solution | Technique |
|---|---|
| Longest substring without repeating characters | Sliding window |
| Median of two sorted arrays | Merge and select |
| Longest palindromic substring | Expand around each center |
| Zigzag conversion | Row simulation |
| Reverse integer | Checked decimal arithmetic |
Prerequisites are CMake 3.20+, a C++20 compiler, and GoogleTest 1.14 or a
compatible packaged version. On Ubuntu, install g++, cmake, ninja-build,
and libgtest-dev, then run:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failureAlternatively, Conan can supply GoogleTest:
conan install . --output-folder=build --build=missing
cmake --preset conan-release
cmake --build --preset conan-release
ctest --preset conan-releaseEach header intentionally retains LeetCode's global Solution class interface,
so the test programs are separate executables. Tests cover all solutions and
include deterministic generated cases, but they are not substitutes for the
platform's full judge suite. Inputs are expected to meet each linked exercise's
documented constraints, except where tests explicitly define behavior.
The problem names, statements, examples, trademarks, and platform test data belong to their respective owners and are not licensed by this repository. No problem statements or proprietary judge data are included here. The original solution, test, and build code in this repository is available under the MIT License.