TikTok Interview Question

Count distinct island shapes in a grid