Code Lab

Modo entrevista. Temporizador de 10 min, sin pistas y sin autocompletado

Is the word a palindrome

MediaStrings10 min

Write a function isPalindromeWord(word) that returns true when word is a palindrome and false otherwise.

  • word has only Latin letters, from 1 to 1000 of them.
  • The check is case insensitive: 'Racecar', 'NOON' and 'abBA' are palindromes.
  • A word of one letter is a palindrome.
  • Return true or false.

Tip: at the whiteboard there was no IDE. Try two indexes, one from each end of the word, that move toward each other (two pointers). The tests check only the result.

Ejemplos

isPalindromeWord('Racecar')

Devuelve true

isPalindromeWord('Level')

Devuelve true

isPalindromeWord('hello')

Devuelve false

Fuente

Cargando el editor…
  1. EntradaisPalindromeWord('Racecar')
    Esperadotrue
  2. EntradaisPalindromeWord('Level')
    Esperadotrue
  3. EntradaisPalindromeWord('hello')
    Esperadofalse

Las pruebas ocultas se ejecutan al enviar