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

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