/CrackTheCodingInterview

Tests, Questions and Solutions from Crack The Coding Interview

Primary LanguageJava

Acknowledgement

All of us should give credits to Gayle Laakmann McDowell for her great work on Cracking the Coding Interview. Ctci saves us a lot of time to improve problem solving skills and makes the preparation more efficient.

Why this repo

Ctci stands out by providing not only questions but also incremental hints and solutions. However, comparing to online judge systems, Ctci doesn't come with tests. This repo attempts to fill this gap by adding tests for each question.

  • First, writing tests helps to understand the question.
  • Second, we can improve our testing skills
  • Last but not least, tests allow to try out many different solutions.

Get started

This repo includes three git branches:

  • questions-only: Use this branch to practice both your testing and problem solving skills.
  • questions-and-tests: With provided tests, you can focus on solving problems.
  • master: Compare your tests and solutions with references.

To get started, please follow the steps below:

  1. Fork this repository

  2. Practice

    • Checkout questions-only branch if you prefer to write both tests and solutions
    • Checkout questions-and-tests branch if you only care about finding solutions
  3. Compare with the reference. For instance,you want to check the optimal solution for IsUnique

    git diff master -- src/main/java/arraystring/_01_01_IsUnique.java

  4. Give your feedback! If you find better solutions or tests, we'd love to see your Pull Request.

Keep practicing

Don't worry if you stuck on questions. When it happens, go out for a walk, eat an ice cream or send me a tweet. Come back later when you feel better. The most important thing is that you keep practicing.