Editorial Given is wrong and also the testing ways seems erroneous


#1

Check for A : [ 2, 3, 4, 2, 3, 3 ]

The solution given in editorial gives the output: 4 3 4 2 4 3
But the correct output should be : 4 4 4 2 3 3