• 263

What will I learn?

BFSFlood fillMemoizationRecursion

Using recursive functions on a large 2 dimensional grid, you implement flood filling algorithm and have to improve the performance of your code using memoization.


The goal of this puzzle is to find in a grid the list of adjacents cells that are from the same type (water or ground) and compute the size of the surface. The complexity of the problem is related to the size of the grid and the need to optimize the number of iteration. You will also have to count cells only once during your traversal.

Solve it

A higher resolution is required to access the IDE


Did you know that the distance between your thumb and your little finger is roughly 20cm? Quite useful to evaluate distances, don't you think? Speaking of evaluating distances, take out your geometry tools, because you will have to measure and compare surface areas with this puzzle.

codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
Online Participants