Month: September 2018

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    …
Read more

September 26, 2018 0

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…
Read more

September 13, 2018 0

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…
Read more

September 3, 2018 0