Approach hintTry it first, then revealHide
Going top-down leaves many possible end cells, so work bottom-up instead: each entry then needs only the smaller of the two entries directly below it. A single array of length n is enough memory.
Going top-down leaves many possible end cells, so work bottom-up instead: each entry then needs only the smaller of the two entries directly below it. A single array of length n is enough memory.