#3675
Minimum Operations to Transform String
specialist · 695 · lc medium +30 · 61.9% accepted · 74 likes · top 62%
Description
Given a lowercase string s, you may repeatedly pick any character c and replace all its occurrences with the next letter in the alphabet (with 'z' wrapping to 'a'). Return the minimum number of such operations to make every character in s equal to 'a'.
Code
1
2
3