Today we will take a look at a simple question I was asked some years ago when interviewing for an internship! The question is called “Find Intersection Point of 2 Linked Lists in Java”. Basically, we will try to write a program that takes two...

## Check if a binary tree is a BST in Java

This is a question that comes quite often as a preliminary / phone interview question. How do we check if a binary tree is a BST in Java? In other words we need to validate if a binary tree is a binary search tree. As...

## Find repeated 10 char sequences in DNA sample

FindĀ repeated 10 char sequences in DNA sampleĀ is just a modified version of Find all repeated substrings of size K, which is a pretty common question that gets asked in interviews. Since I did not find appropriate information about this question online, I decided to take...

## Merge Multiple Sorted Lists of Strings in Java

How would you Merge Multiple Sorted Lists of Strings into one list? I got asked this very question in an interview myself. And to my surprise I was not very sharp on it. The question is about developing an algorithm to find how to merge...

## Zig Zag Tree Traversal in Java

Write a method to find the zig zag tree traversal in a tree. I got asked this question once in an interview. Now I found a few solutions to this problem over the internet, but none was really explaining how to get to the solution,...

## Generate All Permutations of an Array or String in Java

How to generate all permutations of an array or string? This is quite the popular question in interviews… In fact, I personally got asked to generate all permutations of an array or string in 3 interviews last year. Therefore it is essential that if you...

## Remove duplicates from a LinkedList in PHP

The question we are going to take a look at today is how to remove duplicates from a LinkedList. We’re going to be using PHP for the coding part, just because it’s the language I use more these days. Remember, languages don’t matter as much...

## Hot to solve a k-sum problem – Four Sum in PHP

Hello again everyone. It has been quite a while since I last wrote something. Well work and life have been busy lately. Therefore I have not had much time for blogging coding fun. Anyhow, we are going to try to solve Four Sum in PHP...

## Swap Node Pairs

Hello again everyone! Been sometime since I wrote here. Today I wanted to take a peek at a simple Linked List problem – Swap Node Pairs. Took me a bout 5 mins to write it out so it should be a cup of tea! Given...

## Mergesort implementation

I was asked to write a simple merge-sort implementation as the initial warm-up part of an interview. (Meaning knowing how to implement merge-sort is a must-have requirement rather than an optional knowledge). So what’s the algorithm for Merge Sort? We need to divide and conquer!...