We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
The solution was very simple. The problem I had was visualising the problem. It's not two strings/arrays that are one under the other, but a single stream of places in a snake-like arrangement. Once you realize that, the "DP" problem is keeping track of how many spaces and how many blocks there have been. O(n)
Hexagonal Grid
You are viewing a single comment's thread. Return to all comments →
The solution was very simple. The problem I had was visualising the problem. It's not two strings/arrays that are one under the other, but a single stream of places in a snake-like arrangement. Once you realize that, the "DP" problem is keeping track of how many spaces and how many blocks there have been. O(n)