What's a mistake in this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
20th Jul 2022, 6:43 AM
Asmit Choudhary
Asmit Choudhary - avatar
1 Answer
- 1
b is shorter than s you try to get an index of s and apply it at b, but b is too short, so used index is out of possible range example b has index: 01 but not 2 b: " K" if b is " K" chars long and you try char at index 2 it is not possible for (int j=0; j<s.length(); j++) {// all s chars index char dh = b.charAt(j); // get char at b by index of s
20th Jul 2022, 7:35 AM
zemiak