0

hello . in java challenges i tried to reverse my char array but sololearn says my code is not correct dont know why?

https://code.sololearn.com/cekQLQWS4Y6k/?ref=app

14th Jul 2021, 6:48 PM
Reza
Reza - avatar
2 Antworten
+ 4
for (int i=arr.length-1;i>=0 ;i-- ){…
14th Jul 2021, 7:13 PM
JaScript
JaScript - avatar
+ 2
In your for loop it must be int i = arr.length - 1 because the last index of the char array is not the length of the array but 1 less
14th Jul 2021, 7:09 PM
Lisa
Lisa - avatar