DEAD END lunchtime

Can somebody help where i am going wrong in problem dead end in lunch time november…

1 3 5 8

Should give 3 but your solution gives 2

1 Like

why did you do


my approach is a bit similar to yours and i used a map to store positions
check this out :slight_smile:

Code is perfecly fine (a[i]–) what i thought but forgot to write else statement now i have corrected that in else if loop it should have been >=2 i did ==2 .Because i had a different appproach in my mind while iimplemented the different one…
Have a quick look