singleNumber=n=>n.reduce((x,y)=>x^y)
(If you're interested, here's some more JS-golfed solutions.)
singleNumber=n=>n.reduce((x,y)=>x^y)
(If you're interested, here's some more JS-golfed solutions.)
strStr=(a,b)=>a.indexOf(b)
Obviously quite simple.
isNumber=s=>!isNaN(s)&&!!s.replace(/\s/g,'')
Don't know the time complexity of String.prototype.replace
, but I'm assuming it's O(1) time. Correct me if I'm wrong.
I've been code-golfing most of my Javascript solutions now, but this one takes the cake.
myPow=Math.pow