Skip to content

Solutions for Cracking the Coding Interview (McDowell, 6th Edition), written in C++

License

Notifications You must be signed in to change notification settings

galudino/ctci_edition_06

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cracking the Coding Interview: 6th Edition (in C++)

This repository

Foreword

This repository contains work/solutions for
Cracking the Coding Interview: 6th Edition
by Gayle Laakmann McDowell.

The sources (will be) written in C++17.
All sources are WIP (work in progress).

I wanted to have a one-stop solution for practicing coding problems;
the Table of Contents markdown file is hyperlinked with subpages for each chapter --
each chapter page has links to the source files associated with each question.

I am using Visual Studio Code (with a markdown preview extension),
and the Terminal (on macOS).

Table of Contents (interview questions)

Questions I have completed

See Completed Question List
for a checklist of questions I have completed.

Please feel free to fork this repository and have your own working copy.

Folder Structure

build/

  • This folder is not in the repository, but will be generated by CMake when the makebuilds script is run.
    It is not to be added to the repository -- this directory is in the .gitignore.
  • Markdown documents (aside from README.md) are kept here.
  • Used by clang-format to format source code.
  • This document.
  • Used by maketarball to exclude files from the archive generated by said script.
  • zsh script for users running a Unix-based operating system, and building with Makefiles.
  • Runs cmake and creates the following directories with build configurations/Makefiles:
    • build/make/Debug
    • build/make/Release
    • build/make/RelWithDebInfo
    • build/make/MinSizeRel
  • You only need to run ./makebuilds once.
  • Creates a .tar.gz archive of this repository.
  • ./maketarball creates the following file: ctci_edition_06_yyyy-mm-dd_hhmmss.tar.gz;
    the boldfaced portion is a timestamp.
  • You may supply an argument, like this: ./maketarball my_filename.tar.gz if a different filename is desired.

Quick Start (generate, build, run) on Unix-based systems

Step 0

First, write some source code!
Read the src section on where to find the sources.

To build,
please have the following installed on your machine:

  • LLVM (clang) or gcc
  • CMake

We will use the Terminal.

Step 1

Use the provided makebuilds script to generate Makefiles.

your_username@your-machine ctci_edition_06 % ./makebuilds

After the Makefiles are generated,
you will no longer need to use the makebuilds script.
(unless you delete the generated Makefiles.)

Step 2

Then, use the provided ctci6 script to build & run an executable for a given question.

your_username@your-machine ctci_edition_06 % ./ctci6 01 01

drawing

The first argument is the chapter number. (Chapter 01)
The second argument is the question number. (Question 1.1)

There is an implicit third argument, which is the build type.
Debug is the default.

You may supply a third argument; the following are supported:

  • Debug
  • Release
  • RelWithDebInfo
  • MinSizeRel

The example below runs the same executable in Release mode.

your_username@your-machine ctci_edition_06 % ./ctci6 01 01 Release

drawing

More information on building

This repository uses CMake. (see https://cmake.org)

Review Building for more details.

About

Solutions for Cracking the Coding Interview (McDowell, 6th Edition), written in C++

Resources

License

Stars

Watchers

Forks