The Love-Letter Mystery

  • + 0 comments

    Java

    int changeCount = 0;
    for (int i = 0; i < s.length() / 2; i++) {
        changeCount += Math.abs(s.charAt(i) - s.charAt(s.length() - i - 1));
    }
    
    return changeCount;