Search
⌘K

Leetcode 427. Construct Quad Tree

Given an n×n binary grid (n a power of two), recursively build a quadtree by subdividing the grid into four equal quadrants until each region is uniform, creating a leaf node with val equal to the region's bit or an internal node with four children otherwise. The task is essentially a divide-and-conquer check for uniform subgrids and construction of the corresponding quadtree structure.

Asked at:

Uber


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late April, 2026

Uber

Senior

Late April, 2026

Uber

Senior

Mid April, 2026

Uber

Staff

An image is represented as grid of integers. Construct Quadtree representation of the image to compress it.

Your account is free and you can post anonymously if you choose.