Why this is giving wrong answers?

this is my code

hello @dhruvilcodes

check ur updated code here->

also try to solve this in o(n);

@dhruvilcodes
image

all test cases are passing.

pls refresh ur tab and try to submit again

1 Like

thank you very much sir