Some error occured while loading page for you. Please try again.
We use cookies to ensure you have the best browsing experience on our website.
Please read our cookie policy for more information about how we use cookies.
function processData(input) {
var lines = input.split('\n');
var n = Number(lines[0]);
for (var i=1; i<=n; ++i){
var ops=0;
var first_loc = 0;
var last_loc = lines[i].length -1;
do{
var first = lines[i].charCodeAt(first_loc);
var last = lines[i].charCodeAt(last_loc);
if(first!=last){
ops+= Math.abs(first-last);
}
++first_loc;
--last_loc;
}while(first_loc<=last_loc);
console.log(ops);
}
function processData(input) { var lines = input.split('\n'); var n = Number(lines[0]);
}
Runs in all cases
Add Reply Preview cancel