+ 6

I would like to get explanation for this code?

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

16th Apr 2019, 3:05 PM
Hafsa Mohamed
Hafsa Mohamed - avatar
5 Respuestas
+ 7
Elva thanks you did it but still i have doubt can you explain this line like I am five years old while ((index =str.indexOf(' ',index+1))>0)
17th Apr 2019, 3:02 AM
Hafsa Mohamed
Hafsa Mohamed - avatar
17th Apr 2019, 8:29 AM
Hafsa Mohamed
Hafsa Mohamed - avatar
+ 6
Hafsa Hussein It means: while there are spaces in string... If space is found, search from element next to that space so that space won't get repeated... If no space is found, kill while loop
17th Apr 2019, 12:25 PM
Elva
Elva - avatar
+ 6
Elva explained it correctly. 🤓👌
17th Apr 2019, 3:05 PM
David Carroll
David Carroll - avatar
+ 5
While spaces exist push their locations in array then print array
16th Apr 2019, 11:53 PM
Elva
Elva - avatar