Back
Close
  • 19

What will I practice?

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.

Statement

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.

A higher resolution is required to access the IDE

Story

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.

Online Participants