Cracking the coding interview

A list of solutions to commonly asked coding interview questions

General

Arrays

Strings

Trees

Stacks, Queues, and Heaps

Linked Lists

  • Implement a linked list (with insert and delete functions)
  • Find the Nth element in a linked list
  • Remove the Nth element of a linked list
  • Check if a linked list has cycles
  • Given a circular linked list, find the node at the beginning of the loop. Example: A->B->C->D->E->C, C is the node that begins the loop
  • Check whether a link list is a palindrome
  • Reverse a linked list iteratively and recursively

Sorting

  • Implement bubble sort
  • Implement selection sort
  • Implement insertion sort
  • Implement merge sort
  • Implement quick sort