You are given a set of algorithmic problems from a software engineering onsite.
-
Tree path length
: Given the root of a binary tree, return the number of edges in the longest path between any two nodes in the tree.
-
Choose two boundaries
: Given an array of non-negative integers where each value is the height of a vertical line at that index, choose two indices
i < j
that maximize
(j - i) * min(height[i], height[j])
. Return the maximum value.
-
Weighted maze
: Given a 2D grid containing a start cell
S
, a target cell
T
, blocked cells
#
, and non-negative movement costs for traversable cells, compute the minimum total energy required to reach
T
from
S
. Moving into a cell adds that cell's cost. Return
-1
if the target is unreachable.
In the later part of this coding interview, the candidate was allowed to use an AI coding assistant after first explaining the intended approach.