Help with error

code: https://ide.codingblocks.com/s/425158
prob: https://hack.codingblocks.com/app/contests/2022/1078/problem

for each element I iterate towards it’s left and right and store the answer for it
not getting the right answer

the code for iterating left array is different on some sites but the logic for it seems correct to me on pen paper

Yeah there was a minor implementation error. Here I corrected it https://ide.codingblocks.com/s/425167

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.