+ 1
27th Aug 2018, 5:22 PM
Iryna Yudina
Iryna Yudina - avatar
2 Answers
+ 3
The problem is in the loop, when you reach array.length you want to compare the element y+1 which is array.length => it's obviously out of array bonds. You can see the correct upper limit in the loop. Don't forget the index of last element of array is array.length - 1. https://code.sololearn.com/W3Clv7InM0f7/?ref=app
27th Aug 2018, 5:36 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
array is not defined i guess😎
27th Aug 2018, 5:31 PM
Tech Inary
Tech Inary - avatar