+ 1
Guys i was trying to remove
Any string containing the letter "r" But i cannot remove lyre from the arrayList. Please tell me why cannot i remove it https://code.sololearn.com/cn5S1QCX0vp9/?ref=app
3 Respostas
+ 2
the list got shifted
eg:
["rose","love","rosers","lyre"]
in for loop,i = 0
rose contains r,remove rose
list size became 3,i increment to 1
now list became
["love","rosers","lyre"]
since i is 1,love will be skipped,and went to rosers instead
rosers got removed
list size became 2,i = 2
list = ["love","lyre"]
now, 2 is not smaller than list size(i < list.size() ==false)
loop stop
+ 2
Thank you guys