Riot Games Interview Question

Write a function that determines if a given number is odd. Follow up was to do it without using %, /, *, etc.

Interview Answers

Anonymous

Jul 24, 2018

function isEven (val) { val = String(val); return ['0', '2', '4', '6', '8'].includes(val[val.length -1]); }

1

Anonymous

Aug 26, 2016

n % 2 for my initial solution, and bit wise operator for the second