Skip to content

C++ and Python Solutions from the book "Cracking the coding interviews"

Notifications You must be signed in to change notification settings

avidLearnerInProgress/CTCI-solutions

Repository files navigation

Cracking the Coding Interview (CtCI) Solutions"

This repository contains C++ and Python solutions to the problems in the sixth edition of Cracking the Coding Interview by Gayle Lackmann McDowell.

Chapter 1:

  • Is Unique - Determine if a string has all unique characters Overview
  • Check Permutation - Check if one string is a permutation of another Overview
  • URLify - Replace all spaces in string with '%20' Overview
  • Palindrome Permutation - Check if string is permutation of its palindrome Overview
  • One Away - Check if two strings are one or zero edits away Overview
  • String Compression - Perform string compression using counts of repeated characters Overview
  • Rotate Matrix - Rotate given nxn image by 90 degrees inplace Overview
  • Zero Matrix - Replace other elements in rows and columns if element is 0 Overview
  • String Rotation - Check if string s2 is rotation of string s1 using isSubstring() Overview

Chapter 2:

  • Remove Dups - Remove duplicates from unsorted linked list C++ | Python
  • Return Kth To Last - Find kth to last element of singly linked list C++ | Python
  • Delete middle node - Delete a node in middle of singly linked list C++ | Python
  • Partition - Partition singly linked list around x C++ | Python
  • Intersection - Given 2 SLL, check if they intersect C++ | Python
  • Loop Detection - Detect loop in Circular Linked List C++ | Python
  • Sum Lists - Add 2 numbers represented by Linked Lists C++ | Python

Chapter 3:

  • Three In One - Implement k(3) stacks using single array C++ | Python
  • Stack Min - Design min stack that performs push, pop and min in O(1) C++ | Python
  • Stack Of Plates - Implement set of stacks with popAt operation C++ | Python
  • Queue Via Stacks - Implement queue data structure with 2 stacks C++ | Python
  • Sort Stacks - Sort stack in ascending order using a temporary stack C++ | Python
  • Animal Shelter - Design system to allocate animals on FIFO basis from animal shelter C++ | Python

Chapter 4:

  • Route Between Nodes - Check if path exists between two nodes of directed graph C++ | Python
  • List Of Depths - Create LinkedList of Nodes at each depth of binary tree C++ | Python
  • Check Balanced - Check if Binary Tree is balanced C++ | Python
  • Minimal Tree - Construct Binary Search Tree from Sorted Array C++ | Python
  • Validate BST - Check if Binary Tree is Binary Search Tree C++ | Python
  • First Common Ancestor - Find first common ancestor for 2 nodes in Binary Tree C++ | Python

Miscellaneous:

  • Problems - List of relevant problems implemented outside of CTCI

Todo's:

  • Readme per chapter explaining solutions
  • Blog posts per chapter
  • Code refactoring
  • Alternatives to organise readme in better manner

About

C++ and Python Solutions from the book "Cracking the coding interviews"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published