Depth First Search (DFS) Interview Questions

Browse depth-first search (DFS) technical interview questions and explore the world's largest library of mock video interview recordings.

Depth First Search (DFS) Interview questions and solutions

Get step-by-step instructions on how to approach and solve common technical interview questions.

MEDIUM
Find Leaves of Binary Tree

Given a binary tree, extract all the leaves in repeated succession into a list of lists by starting at the bottom and working your way upwards.

Watch 1 interview
MEDIUM
Data Structures and Algorithms
Count Complete Tree Nodes

Given the root of a complete binary tree, return the number of nodes in the tree.

Watch 1 interview
MEDIUM
Data Structures and Algorithms
Number of Islands

Given a 2D matrix, where "1" represents land and "0" represents water, count how many islands are present.

Watch 1 interview
MEDIUM
Data Structures and Algorithms
Boundary of Binary Tree

The boundary of a binary tree is the concatenation of the root, the left boundary, the leaves ordered from left-to-right, and the reverse order of the right boundary.

Watch 1 interview

We know exactly what to do and say to get the company, title, and salary you want.

Interview prep and job hunting are chaos and pain. We can help. Really.