How to find duplicate number in string? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to find duplicate number in string?

If i type sololearn it shows o: 2, l: 2?? Help

14th Mar 2017, 2:49 PM
Daphnyzyb Pelaez
Daphnyzyb Pelaez - avatar
1 Answer
+ 14
You may use this code as reference: https://code.sololearn.com/cTLVtH9p0iEo/?ref=app But this is not complete for your task. You need to compare the string to all alphabets. I suggest using ASCII values. https://code.sololearn.com/c9Gs7U4rok1z/?ref=app So instead of comparing the string to just some characters, you try to iterate the ASCII list for alphabets. Evaluate if frequency of character occurrence in string is more than 1.
14th Mar 2017, 2:57 PM
Hatsy Rei
Hatsy Rei - avatar