JavaScript solutions for Cracking the Coding Interview, 5th Edition

Contributed by students of Code Fellows 401 JavaScript (2016 Jan-March Cohort)

All files in repo are named according to the 5th edition. Problems that appear in the 6th edition, but not in the 5th edition are appended.

Chapter 1: Arrays and Strings

Number Name 5th Ed 6th Ed Solutions
1 isUnique 1.1 1.1 5
2 flipString 1.2 N/A 3
3 isPerm 1.3 1.2 2
4 permPal N/A 1.4 4
5 urlify 1.4 1.3 2
6 compressStr 1.5 1.6 2
7 oneAway N/A 1.5 2
8 rotateMatrix 1.6 1.7 2
9 zeroMatrix 1.7 1.8 2
10 strRotation 1.8 1.9 3

Chapter 2: Linked Lists

Number Name 5th Ed 6th Ed Solutions
1 removeDuplicates 2.1 2.1 2
2 kToEnd 2.2 2.2 2
3 deleteMiddleNode 2.3 2.3 2
4 partitionList 2.4 2.4 1.5
5 sumList 2.5 2.5 3
6 loopDetection 2.6 2.8 2
7 isPalindrome 2.7 2.6 4
7 intersection N/A 2.7 2

Chapter 3: Stacks and Queues

Number Name 5th Ed 6th Ed Solutions
1 threeInOne 3.1 3.1 2
2 stackMin 3.2 3.2 1
3 setOfStacks 3.3 3.3 1
4 myQueue 3.5 3.4 1
5 sortStack 3.6* 3.5 1
6 animalShelter 3.7 3.6 1
7 towerHanoi 3.4 N/A 0
  • 5th Ed. asks to sort in ascending order. 6th Ed. asks for descending order.

Miscellaneous

Name Source Solutions
Tyler's tree print Tyler 1