NEED HELP IN THIS QUESTION PRFCTN

my logic is , first find the minimum element then except min element make all element equal to min element. to make other element equal to min element find the longest continous substring and make it equal to min element…
Pls help @vjju123 @ssjgz @I_returns
solution - Online Compiler and IDE - GeeksforGeeks

I didn’t do this question, but there’s an obvious testcase where this approach fails:

1
4
2 3 2 1

The Editorial is here: PRFCTN Editorial - editorial - CodeChef Discuss

1 Like

Output according to you ??

The output should be 2.

My code prints 3 , I found my mistake.
Thanks.

1 Like