/CtCI-6th-Edition-JavaScript

Cracking the Coding Interview 6th Ed. JavaScript Solutions

Primary LanguageJavaScript

Cracking the Coding Interview 6th Edition - JavaScript

Instructions

  • This repository contains JavaScript attempts on questions listed in the book.

  • So far, code or short writeups are available for the first 10 chapters.

  • At Gayle's request, the files only contain code, and do not contain the actual questions. For the questions, please support Gayle by purchasing the book.

  • Under each JavaScript file, there are tests to check that the code is working as expected. For convenience, simple logging is used to test the functions. To run the tests, just cd into the folder containing the .js file and run node <fileName>.js to run the tests.

  • Contributions welcome

List of Coding Questions:

Chapter 1

  • 1.1 - Is Unique
  • 1.2 - Check Permutation
  • 1.3 - URLify
  • 1.4 - Palindrome Permutation
  • 1.5 - One Away
  • 1.6 - String Compression
  • 1.7 - Rotate Matrix
  • 1.8 - Zero Matrix
  • 1.9 - String Rotation

Chapter 2

  • 2.1 - Remove Dups
  • 2.2 - Return Kth to Last
  • 2.3 - Delete Middle Node
  • 2.4 - Partition
  • 2.5 - Sum Lists
  • 2.6 - Palindrome
  • 2.7 - Intersection
  • 2.8 - Loop Detection

Chapter 3

  • 3.1 - Three in One
  • 3.2 - Stack Min
  • 3.3 - Stack of Plates
  • 3.4 - Queue via Stacks
  • 3.5 - Sort Stack
  • 3.6 - Animal Shelter

Chapter 4

  • 4.1 - Route Between Nodes
  • 4.2 - Minimal Tree
  • 4.3 - List of Depths
  • 4.4 - Check Balanced
  • 4.5 - Validate BST
  • 4.6 - Successor
  • 4.7 - Build Order
  • 4.8 - First Common Ancestor
  • 4.9 - BST Sequences
  • 4.10 - Check Subtree
  • 4.11 - Random Node
  • 4.12 - Paths with Sum

Chapter 5

  • 5.1 - Insertion
  • 5.2 - Binary to String
  • 5.3 - Flip Bit To Win
  • 5.4 - Next Number
  • 5.5 - Debugger
  • 5.6 - Conversion
  • 5.7 - Pairwise Swap
  • 5.8 - Draw Line

Chapter 6

  • 6.1 - Heavy Pill
  • 6.2 - Basketball
  • 6.3 - Dominos
  • 6.4 - Ants on a Triangle
  • 6.5 - Jugs of Water
  • 6.6 - Blue-Eyed Island
  • 6.7 - The Apocalypse
  • 6.8 - The Egg Drop Problem
  • 6.9 - 100 Lockers
  • 6.10 - Poison

Chapter 7

  • 7.1 - Deck of Cards
  • 7.2 - Call Center
  • 7.3 - Jukebox
  • 7.4 - Parking Lot
  • 7.5 - Online Book Reader
  • 7.6 - Jigsaw
  • 7.7 - Chat Server
  • 7.8 - Othello
  • 7.9 - Circular Array
  • 7.10 - Minesweeper
  • 7.11 - File System
  • 7.12 - Hash Table

Chapter 8

  • 8.1 - Triple Step
  • 8.2 - Robot in a Grid
  • 8.3 - Magic Index
  • 8.4 - Power Set
  • 8.5 - Recursive Multiply
  • 8.6 - Towers of Hanoi
  • 8.7 - Permutations without Dups
  • 8.8 - Permutations with Dups
  • 8.9 - Parens
  • 8.10 - Paint Fill
  • 8.11 - Coins
  • 8.12 - Eight Queens
  • 8.13 - Stack Boxes
  • 8.14 - Boolean Eval

Chapter 9

  • 9.1 - Stock Data
  • 9.2 - Social Network
  • 9.3 - Web Crawler
  • 9.4 - Duplicate URLs
  • 9.5 - Cache
  • 9.6 - Sales Rank
  • 9.7 - Personal Financial Manager
  • 9.8 - Paste Bin

Chapter 10

  • 10.1 - Sorted Merge
  • 10.2 - Group Anagrams
  • 10.3 - Search In Rotated Array
  • 10.4 - Sorted Search No Size
  • 10.5 - Sparse Search
  • 10.6 - Sort Big File
  • 10.7 - Missing Int
  • 10.8 - Find Duplicates
  • 10.9 - Sorted Matrix Search
  • 10.10 - Rank From Stream
  • 10.11 - Peaks And Valleys

Test

npm test