possible(T)
that returns True
if it's possible to reach the end at time T
using DFS.T
from 0
to max(grid)
.possible(mid)
where mid
is the midpoint of the current search range.possible(mid)
returns True
, search the lower half; otherwise, search the upper half.T
that returns True
for possible(T)
.T
.