You are viewing a single comment's thread. Return to all comments →
Why do you use abs? I have seen a couple of examples using it and I still can't get it, I have tried using it in javascript but does not work
function processData(input) { var arr = input.split(/[\n]+/); var tn = parseInt(arr.shift()), t = 0; while (t < tn) { var s = arr[t]; var l = s.length; var f = 1; for (var i = 1; i < l; i++) { if (Math.abs(s[i] - s[i - 1]) == Math.abs(s[l - i] - s[l - i - 1])) { f = f + 1; } } console.log(f == l ? 'Funny' : 'Not Funny'); t++; } }
Seems like cookies are disabled on this browser, please enable them to open this website
Funny String
You are viewing a single comment's thread. Return to all comments →
Why do you use abs? I have seen a couple of examples using it and I still can't get it, I have tried using it in javascript but does not work