The fastest solution given is wrong and yet the test cases fail to recognize that.
Consider this input: 15 1 2 4 3 -1 5 -1 -1 -1 6 -1 -1 -1
The correct output should be: 1 2 3 6
The fastest solution given is wrong and yet the test cases fail to recognize that.
Consider this input: 15 1 2 4 3 -1 5 -1 -1 -1 6 -1 -1 -1
The correct output should be: 1 2 3 6