We have to iterate over the given string and decrease the value of every character. But for some cases the new value would become less than the value of 'a'.

In these cases, we have to determine the new character considering the whole alphabet as a cycle.

There are various ways of implementing this. One of them is given here:

if (word[i] - left is less than 'a') {
	diff = 'a' - (word[i] - left)				
	word[i] = 'z' + 1 - diff
}

Statistics

87% Solution Ratio
kimiyukiEarliest, Feb '19
fire_tornadoFastest, 0.0s
ReduancsLightest, 0 B
saitotaShortest, 37B
Toph uses cookies. By continuing you agree to our Cookie Policy.