You are viewing a single comment's thread. Return to all comments →
Java solution:
int count = 0; int start = 0; int end = s.length() - 1; while(true){ if(start >= end) return count; int diff = Math.abs(s.charAt(start) - s.charAt(end)); count += diff; start++; end--; }
Seems like cookies are disabled on this browser, please enable them to open this website
The Love-Letter Mystery
You are viewing a single comment's thread. Return to all comments →
Java solution: