# Tag: Coding Interview

### Binary Search Tree – In Order Successor Node – Interview Question

Given a node in a Binary Search Tree, find the next node as per in order traversal. Let’s find out how to answer this question in a technical interview. To begin with, let’s cover real quick what is a binary search tree? A binary search tree is a binary tree data structure with three main…

### Add Numbers without using Plus operator – Interview Question

You have to write an algorithm that adds two numbers but you are not allowed to use the plus operator. The first thought that comes to my mind is using binary numbers. We need to think how we can do addition using binary numbers and what all are the steps you follow when you actually…

### REST APIs And Their Versioning – Interview Question

What are REST APIs and how they are versioned. Let’s see how to answer this question in a technical interview. To begin with, what are REST APIs? The term REST stands for Representational State Transfer. Web services that adhere to REST architectural standards are called RESTful APIs. The REST APIs have a: i) A base…

### Detect Loop In Linked List – Interview Question

To begin with you can draw a linked list on the whiteboard. A linked list has nodes in it which are connected to each other. Each node has two components: the value and reference to next node. The head node points to the first element of the linked list. The first thing that comes to…

### 2 Eggs – 100 Floors – Interview Question

You are given two Eggs and you are in a building with 100 Floors. You have to find the minimum floor from which if an egg is dropped, it won’t break. You have to do this in such a manner that your worst case number of attempts is minimized. Let’s find out how to answer…

### Are Characters Unique in a String – Interview Question

Does a string have all unique characters? Let’s find out how to answer this question in a technical interview The first solution that comes to mind is to have two for loops. In the outer for loop, you pick one character from the string, let’s call it c1. You then compare c1 to rest of…

### Find Middle Element in a Linked List – Interview Question

Find out middle element in a linked list. Let’s see how to answer this question in a technical interview. To begin with you can draw a linked list on the whiteboard. A linked list has nodes in it which are connected to each other. Each node has two components: the value and reference to next…

### Rotate Elements in Matrix – Interview Question

Rotate Elements in a Matrix. Let’s find out how to answer this question in a technical interview. Let’s take a sample matrix 1     2      3      4 5     6      7      8 9     10    11    12 13   14    15    16   If we rotate it, this is how it will look like 5      1      2      3 9    …

### How HashTables Work

How do Hash Tables Work? To Begin with, what is a HashTable? Simply, it is a data structure that can map keys to values. Why is it important? You can look up the data in constant time i.e. O(1). How does it work? Internally, it’s an array of buckets or slots. There is something called Hash…

### Find Triplet in Array that sum to a Given Value

In today’s post, I will be discussing an interview question related to arrays. This is similar to my previous post, in which I discussed how to find a pair with a given sum in an array. Suppose you are given an array. [1,9,7,6,3,5,2,8] And you are given a targetSum = 10. You have to find…