Tag view

#dfs

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with dfs

2 cards

Coding Exercises Medium O(n)

Binary Tree Traversals

Write a DFS helper that appends the current node before, between, or after visiting children depending on which traversal you are building.

Return the inorder, preorder, and postorder traversals of a binary tree.

Coding Exercises Medium O(rows * cols)

Number of Islands

Scan the grid cell by cell. When you find unvisited land, increment the island count and run DFS or BFS to mark every connected land cell as visited.

Count how many islands of connected land exist in a grid of '1' and '0' values.