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

Codility - Lesson 16 Greedy algorithms - 2. MaxNonoverlappingSegments

Source Link: https://app.codility.com/programmers/lessons/16-greedy_algorithms/max_nonoverlapping_segments/ Question: Located on a line ...