The coding round reportedly included two algorithmic tasks:
-
Rebuild a binary search tree from a preorder sequence
-
You are given an array of distinct integers representing the preorder traversal of a binary search tree.
-
Reconstruct the original tree and return its root.
-
Aim for a solution that runs in linear time.
-
Traverse a matrix in clockwise layers
-
You are given an
m x n
integer matrix.
-
Return all elements in the order obtained by repeatedly visiting the current outer boundary clockwise and then shrinking the boundary until every cell has been visited.