0
Need help. Where is a bug? (cpp)
Where is a bug in my code? Same function but different bugs. https://code.sololearn.com/cZtIuFv3rIWy For increasing sequence - all good. For decreasing sequence - it dont like when it in end. i have tried to debug in VS but when i fix bug in one sequence - i take it in other place
2 ответов
+ 2
It seems to me that the problems are in the for loops and especially the bottom boundary => when i becomes 0 then arr[i -1] is in fact arr [0 - 1] => arr [-1], so the array is out of bounds. I think you should change i to 1, so the last check will be for arr [0] => the first element in the array.
0
thank you so much. and now remain two bugs :) why it not work with long long numbers? and why it not work with short sequence like 174523?