← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
You are given an n x n binary matrix grid, where n is a power of 2. Build and return the root of a quad tree that represents the matrix.
Each node represents a square region:
val, isLeaf, topLeft, topRight, bottomLeft, and bottomRight.
For this practice environment, use val = false for every non-leaf node so the returned structure is deterministic across languages.The full grid is not uniform, so the root is an internal node with four leaf children.