Coding Interview Club

Prepare for coding interviews in simple and structured steps

To understand merge sort completely you should be thorough about the concepts of recursion and the concept of divide and conquer. The basic idea is to divide the array into smaller segments recursively until there is only 1 element in each array segment.

  1. Write an algorithm to reverse a string.
    1. Assumptions
      1. You cannot use any library functions.
      2. You may use charAt (if needed.)
  1. Merge two sorted arrays A and B in sorted order. A has enough locations in the end to hold the elements of B.
    • No extra buffer should be used.
    • Every element should be shifted from its current position in A, at most 1 time.
    • Hint:
  1. Find all pairs of integers within an array that sum to a specified value:
    • Approach 1: Using hash table (more time efficient)
    • Approach 2: Through sorting (more space efficient)

I will list down some problems on the topic of linked lists that are commonly asked in interviews.

 

Important concepts to revise before trying out the problems:

Below are some of the problems based on stacks and queues. You will also find applications of stacks and queues in other sections such as Trees and Graphs.

 

Important Points to Remember 

  1. Write methods to implement the multiply, substract and divide operations for integers, using only the add operator.
    • Hint:
      • a + b => a + negate(b)
      • a * b => add b a times
      • x = a / b => a = bx.
Back to Top