It was two stupid mistakes:

1) forgot to set the value of v[k + max] to x after the code block that
increments x and y
2) a[x + 1] and b[x+ 1] should not be adding one to the index
(algorithm is 1 based)

Reply via email to