LeetCode C++

Why?

There are probably a hundred other repos on Github with excellent solutions and great explanations of the code, however, I found very few that contained solutions and tests written using C++ and from the few that I found, most were difficult to run locally.

So, with that in mind, this repo aims to provide a simple project structure that is easy to run locally.

Getting Started

Requirements

  • C++11 compatible compiler: g++ (version >= 4.2), or clang++ (version >= 3.0)
  • CMake (version >= 3.0.2)
  • Catch2. Currently, this project expects Catch2 to be installed locally. Most likely in the future I will modify the project setup to be more portable and include catch.hpp instead of expecting a local installation.

Building

  1. mkdir -p build
  2. cd build
  3. cmake ..
  4. make

For convenience, scripts/clean.sh is provided to clean the build directory and subsequently create a new build folder.

Running Tests

Still in build/, execute tests/Test to run test binary.