info
Importante: Para que se registre el resultado tienes que iniciar sesión.
Unique Words
Medio25 pts·Strings
Enunciado
Given a string with words separated by spaces, return an array with the words that appear exactly once, in the same order they first appear in the string.
The comparison must be case-insensitive (i.e., "Hello" and "hello" are considered the same word), but the words in the result must appear exactly as they were found the first time.
Examples
uniqueWords("hello world hello"); // ["world"]
uniqueWords("one two three two one"); // ["three"]
uniqueWords("a b c d"); // ["a", "b", "c", "d"]
uniqueWords("Hello hello HELLO"); // []
uniqueWords(""); // []
Notes
- If there are no unique words, return an empty array
[]. - The string can be empty.
- There will be no punctuation, only words and spaces.
Restriccionesexpand_more
- Dificultad: Medio
- Completa todos los test cases para obtener los 25 puntos.
- No modificar la línea
exportal final del archivo. - Se recomienda evitar el uso de inteligencia artificial para que realmente tú practiques los ejercicios.
Puedes usar console.log() para depurar. Los resultados aparecen en la Consola de salida, no en el navegador.
Inicia sesión para reaccionar
Inicia sesión para reaccionar