← Questions

Biggest connected component after filling one row or column

0
CognitionCodingLast asked Jul 2026

A coding interview question asked in Cognition's online assessment, last asked Jul 2026. It tests grids, connected components and union-find.

You get an h by w grid of 0s and 1s. A cell holding 1 is filled, and filled cells that touch up, down, left or right belong to the same group.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

What it tests

grids · connected components · union-find

Your code and the AI tutor open when you unlock this question.