Stage III: Easy Questions
Trees (BT, BST)
Maximum Depth of Binary Tree
Task: Find the height (or maximum depth) of a binary tree.
Companies: Amazon, Google, LinkedIn, Apple
Invert Binary Tree
Task: Swap the left and right children for every node in a binary tree, creating a mirror image.
Companies: Google, Amazon, Apple
Validate Binary Search Tree
Task: Determine if a given binary tree is a valid Binary Search Tree (BST).
Companies: Amazon, Facebook, Microsoft, Bloomberg
Binary Tree Level Order Traversal
Task: Traverse the tree level by level and return the node values in an array of arrays.
Companies: Amazon, Facebook, LinkedIn, Microsoft
Lowest Common Ancestor of a Binary Search Tree
Task: Find the lowest common ancestor (LCA) of two given nodes in a BST.
Companies: Amazon, Facebook, Microsoft, Twitter
Graphs
Number of Islands
Task: Given a 2D grid map of '1's (land) and '0's (water), count the number of islands.
Companies: Amazon, Google, Facebook, Microsoft
Clone Graph
Task: Given a reference to a node in a connected undirected graph, return a deep copy (clone) of the graph.
Companies: Facebook, Amazon, Google
Course Schedule
Task: You are given courses and prerequisites. Determine if it is possible to finish all courses.
Companies: Amazon, Facebook, Google
Rotting Oranges
Task: In a grid of oranges, determine the minimum time until no fresh oranges are left.
Companies: Amazon, Google
Find if Path Exists in Graph
Task: Given a graph and two vertices, determine if a path exists between them.
Companies: Amazon