Count Distinct Island Shapes with Rotation and Translation
Asked at Coupang · Coding Questions · Difficulty: Hard · Last asked Jul 15, 2026
A grid marks land with `'1'` and water with `'0'`. An island is a maximal group of land cells connected horizontally or vertically. Two islands have the same shape if one can be moved onto the other by translating it, rotating it by a multiple of 90 degrees, or both. Count how many different island shapes the grid contains.
Loading the problem…