top and bottom. Think of them as a two-row table where column i is the pair top[i], bottom[i]. In one move you pick a column and swap its upper and lower numbers.
Return the smallest number of moves after which both rows are strictly increasing. It is guaranteed that this can be done.top=[1, 6, 3, 8], bottom=[2, 2, 7, 9] → 1
Swap column 1: the top row becomes [1, 2, 3, 8] and the bottom row [2, 6, 7, 9], both strictly increasing after a single swap.
top=[1, 2, 3], bottom=[4, 5, 6] → 0
Both rows are already strictly increasing.
top=[5, 2, 7, 4], bottom=[1, 6, 3, 8] → 2
top=[1, 6, 3, 8], bottom=[2, 2, 7, 9]
1
Run checks the first 3 tests in your browser. Submit checks all 32 tests on the server, hidden ones included.