deno.land / x / masx200_leetcode_test@10.6.5 / reverse-vowels-of-a-string / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
export default function reverseVowels(s: string): string { const set = new Set(["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"]);
const vowels = Array.prototype.filter.call(s, (c) => set.has(c)); let i = vowels.length - 1;
return Array.prototype.map .call(s, (c) => (set.has(c) ? vowels[i--] : c)) .join("");}
masx200_leetcode_test

Version Info

Tagged at
a year ago