Solve array, tree, and maze problems
Company: Meta
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Take-home Project
The onsite interview included the following algorithmic tasks:
1. **Building visibility from the right**: Given an integer array `heights`, where `heights[i]` is the height of the `i`th building in a row, return the indices of buildings that can see the ocean on the right. A building can see the ocean if every building to its right is strictly shorter. Return the indices in increasing order.
2. **Binary tree vertical grouping**: Given the root of a binary tree, return the node values grouped by vertical column from left to right. Nodes in the same column should be reported from top to bottom. If multiple nodes share the same row and column, output them in the order they are visited by a breadth-first traversal.
3. **Maze pathfinding in an AI-assisted coding round**: Given a 2D grid where `0` represents an open cell and `1` represents a wall, along with a start cell and a target cell, determine whether there is a valid path from start to target by moving up, down, left, or right.
Quick Answer: This question evaluates algorithmic problem-solving across arrays, binary trees, and grid pathfinding, testing competencies in array traversal and visibility reasoning, vertical column grouping and ordering in trees, and reachability/search in 2D grids.