can you have a look at my Code ? | Sololearn: Learn to code for FREE!

+5

can you have a look at my Code ?

Just a small bug i have tried to find out but unable to find out :) arr = 2 ,3 ,0 ,0 ,1 ,4 This is what i want > output = 3 ,4 ,1 ,1 ,4 ,-1 This is what I'm getting > output = 0 ,4 ,1 ,1 ,4 ,-1 here is my attempt ๐Ÿ‘‡ https://code.sololearn.com/c64NquYQajfw/?ref=app

9/21/2022 8:50:34 AM

Davinder Kumar

2 Answers

New Answer

+3

Take condition i >= 0 instead i > 0 . Missing to check last value at index 0. Good use of stack.. Good logic..๐Ÿ‘

+1

thank you sir ๐Ÿ˜‡