Fill the k-band and backtrace the optimal global alignment.
Row buffers are addressed by the column window of the current row: row i covers the columns [jStart, jEnd] and stores cell (i, j) at the slot (j - jStart) + 1. Slot 0 and slot (w + 1) are permanent sentinels that always hold KBandSearch.UNREACHABLE, so that the inner loop needs no boundary check at all.
As the window of row i-1 is shifted by at most one column against the window of row i, the neighbouring cells are located at:
diag (i-1, j-1) => prev[cj + delta] up (i-1, j) => prev[cj + delta + 1] left (i, j-1) => cur[cj]
in which delta = jStart(i) - jStart(i-1) is either 0 or 1.
The edit distance, or a negative value when the target cell (l1, l2) turns out to be unreachable inside the band of width k.