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 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More

#### 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

Read More