This repository contains the solutions to cracking the coding interview/LeetCode in C++. Most of the solutions available on other repositories are mostly follow C style coding. This repo attempts to follow modern C++ guidelines. In addition, this contains test cases and benchmarking to evaluate the correcting and the running time of the algorithms.
The build is based on Bazel offered by Google. It also uses Gtest for implementing test cases and google benchmarks for benchmarking running time.
algorithms-practice
├──include
│ └── arrays_strings
│ ├── BUILD
│ └── example.h
│
├──tests
│ ├── test
│ │ └── arrays_strings
│ │ └── example_test.cpp
│ ├── benchmark
│ │ └── arrays_strings
│ │ └── example_benchmark.cpp
│ └── BUILD
├──third_party
│ ├── gtest.BUILD
│ └── benchmark.BUILD
└── WORKSPACE
- Install bazel
- Install GCC-5 or above
- Make sure CC and CXX environment variables are pointing to the latest GCC version in /user/bin
- Clone this repository and enter the repo directory
- Build the code:
bazel build ...
- Run test cases:
bazel run test:algorithms-test
- Run benchmarks:
bazel run test:algorithms-benchmark
- Do add new solution. Create a new 'example.h' file in the appropriate directory inside the include folder. Add corresponding test in test/'appropriate'/ directory. Do the same for benchmark
- Add log tools like google logs
- Add gsl (guideline support library)
- Add code coverage