+ 3
[Challenge🏆🏆🏆] Print index of '0' in string
given a string as input, print the index of the first, second and third occurrence of 0 in the string or else print "not found". you have to use indexOf to solve this problem and cannot use for loop and charAt. test case:-1 Input:----"9810098100" Expected output:---- first:3 second:4 third:8 test case:2 input:---"0" Expected output:----- first:0 not found test case:3 input:---"10101" Expected output:------- first:1 second:3 not found
3 Antworten
+ 3
@Cpasgrave
this is showing error in line 1st
+ 2
@Sahik Luthra
Thank you Sahil, I wrote it on pc and forgot to modify for codeplayground. Just corrected it. Now it works.
+ 1
I don't know java, wrote it with python :
https://code.sololearn.com/cNmAaHssrtmW/?ref=app