Some error occured while loading page for you. Please try again.
You are viewing a single comment's thread. Return to all comments →
With the help of recursion it solves pretty easy:
function calcOperations(row, left, right) { if (left >= right) return 0; var leftCode = row.charCodeAt(left); var rightCode = row.charCodeAt(right); var diff = Math.abs(rightCode - leftCode); return diff + calcOperations(row, left + 1, right - 1); }
Add Reply Preview cancel
simplicity wins!
Create An Account
Or connect with
By signing up you agree to our Terms of Service and Privacy Policy
With the help of recursion it solves pretty easy:
Add Reply Preview cancel