Saturday, September 2, 2017

Interview Question - Shift Character in Alphabet

Source Link:
https://stackoverflow.com/questions/10023818/shift-character-in-alphabet

One Answer:


My Solution:
String s;
new char[] my_string = s.toCharArray();
my_string[j] = (char)  (my_string[j] + 1 - (int)'a')  % 26  +  (int) 'a';

No comments:

Post a Comment