Source Code

Source code are the collections of coding interview questions and their source code. Click the title you are interested, you will find the download link of the source code. Cannot find what you want? There are more in my github. Also you can check out the complete list of coding interview questions in my pocket book.


suggested friends in java

Get suggested friends (2 solutions) – code

When you are asked to design the data structures for social network, normally the answer is graph. In the graph, ...
Read More
least common set with union find

Find Least common set with union find – code

When we have number of sets, and need to group them into joint and disjoint-sets, union–find is the algorithm to ...
Read More

Spell autocorrect with edit distance – Code

Google provides a powerful spell correct for validating the keywords we type into the input text box. It checks against ...
Read More
DFS and adjacent matrix

Depth first search and adjacent matrix – Code

Depth first search (DFS) is an algorithm to traverse each element in the data structure. It starts from the source ...
Read More
royal succession order

Monarchy succession order – code

Monarchy succession order is also known as The line of succession to the British throne. The succession to the British ...
Read More

Remove cycle in directed graph and convert graph to tree – code

A graph is a data structure that consists of a set of vertices (aka nodes) connected by edges. A graph ...
Read More
Build hierarchy tree java

Build hierarchy tree – Code

Build hierarchy tree reads employee data and build a corporation hierarchy tree from the list. HashMap plays important role to ...
Read More
shortest path using Dijkstra java

Shortest path and 2nd shortest path using Dijkstra – code

What is Dijkstra's algorithm? Dijkstra's algorithm is an algorithm to find the shortest paths between vertices in a graph. It ...
Read More
Autocomplete with trie java

Autocomplete with trie – Code

Autocomplete is a feature that search box returns the suggestions based on what you have typed. Autocomplete with trie provides ...
Read More
word break java

Word break using memoization – Code

What is word break? Word break is to divide a string into sub-strings that defined in dictionary. The problem is ...
Read More


Comments are closed