Pergunta de entrevista da empresa Amazon

Write code on the whiteboard that could take user input and determine if it is a palindrome.

Respostas da entrevista

Sigiloso

7 de set. de 2016

function is_palindrome(input) { return (input === input.split('').reverse().join('')); }

6

Sigiloso

27 de jun. de 2017

function isPalindrome(input) { var length = input.length; for( var i=0; i < (length/2 <<0); i++ ) { if( input[i] != input[length-1-i] ) { return false; } } return true; }

2