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? Please check out my github and my Java coding book.


find all subset string

Find all subset of string in dictionary – code

Find all subset of string in dictionary is to find the subset of an input string that exists in dictionary ...
Read More
merge two arrays

Merge two sorted arrays (2 solutions) – Code

To merge two sorted arrays in one sorted array, you can loop through the elements of both arrays and compare ...
Read More
modulo operation

Modulo operation and circular array

Modulo is the operation that returns the remainder of one number divided by another. It is a arithmetical operator, represented ...
Read More
last men standing

Last men standing using circular linked list

The "Last man standing" is also called "Josephus problem" or "circle of death problem". Given a number n people standing ...
Read More
detect graph cycle

Detect and remove a cycle in a directed graph

A graph is a data structure that consists of a set of nodes (aka vertices) connected by edges. A graph ...
Read More
suggested friends

Get suggested friends (2 solutions) – DFS and Union Find

To design the data structures for social network, normally the answer is a graph. In the graph, We can use ...
Read More
tell friends story

Tell friends story by timestamp – DFS in weighted graph

In the post of Get suggest friends, we provide solution of DFS in unweighted graph. This post is Tell friends ...
Read More
euler path

Hierholzer’s algorithm for undirected graph – Euler path and longest path

An Euler path is a trail in a graph that visits every edge exactly once. Here we use graph data ...
Read More
Tournament ranking with topo sort

Find ranking with topological sorting – DFS and BFS

Find ranking with topological sorting is to find winner and ranking in tournament. Topological sorting is a graph traversal in ...
Read More
initialize game board

Initialize game board in matrix – Code

Initialize game board in matrix is to populate one digit number into a MxN matrix. The digit can be generated ...
Read More


Comments are closed