DEV Community

loading...

Discussion on: LeetCode 289. Game of Life (javascript solution)

Collapse
hanpari profile image
Pavel Morava

To represent the Game of life state, you may use a set storing unique coordinates.

Typically like this:

state = { (1,2), (1,3), (1,4) }
Enter fullscreen mode Exit fullscreen mode

Coincidentally, I wrote an article about this if you are interested.

Unlike arrays, sets do not tend to run out of memory when the population is growing.