Back to course home
0% completed
Vote For New Content
For the first example, the input array after a cycle sort is performed on it is ...
Richard Yuan
Mar 23, 2022
For the first example, the input array after a cycle sort is performed on it is [5, 4, 3,4, 5]. In the python3 example, performing another iteration to track the duplicates will result in an answer of [5, 4] rather than [4, 5] in case the order of the answer matters to the question.
4
0
Comments
Comments
E
Edu 3 years ago
I was about to comment the same. As the JavaScript solution is using an array for the duplicates, it seems to imply that the order of the return matters but, if that's the case, the output given for the "Example 1" is not properly ordered (it should be "[5, 4]" instead ...
On this page