You are viewing a single comment's thread. Return to all comments →
Agreed. The first sentence of the problem says,
You are given an unordered array consisting of consecutive integers [1, 2, 3, ..., n] without any duplicates.
8 > 7, therefore illegal input.
I was able to work around their buggy test cases by doing,
j = min((int)arr.size(), arr[j]) - 1;
Seems like cookies are disabled on this browser, please enable them to open this website
Minimum Swaps 2
You are viewing a single comment's thread. Return to all comments →
Agreed. The first sentence of the problem says,
8 > 7, therefore illegal input.
I was able to work around their buggy test cases by doing,