Time: , where is columns, is rows, and is average transitions per profile. For typical tiling, is small (constant or logarithmic in ). Space: with a rolling array (store only current and previous column), otherwise .
With , , which fits easily. Precomputing transitions takes worst case, but practice is faster because not all transitions are valid.