Solución
solution.tsTypeScript
function uniqueWords(text: string): string[] {
if (!text.trim()) return [];
let freq: Record<string, number> = {}
let words = text.toLowerCase().split(' ')
words.forEach((word) => freq[word] = (freq[word] || 0) + 1)
return words.filter((word) => freq[word] === 1 )
}
// Do not modify: needed to evaluate the result.
export { uniqueWords };
0respuestas