+ 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

19th Jun 2020, 2:55 PM
stephen haokip
stephen haokip - avatar
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
19th Jun 2020, 3:27 PM
durian
durian - avatar
+ 2
Thank you guys
19th Jun 2020, 3:44 PM
stephen haokip
stephen haokip - avatar