deno.land / x / masx200_leetcode_test@10.6.5 / reverse-prefix-of-word / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
function reversePrefix(word: string, ch: string): string { const index = Array.prototype.findIndex.call(word, (c) => c === ch);
if (index < 0) return word; return ( Array.from(word.slice(0, index + 1)) .reverse() .join("") + word.slice(index + 1) );}export default reversePrefix;
masx200_leetcode_test

Version Info

Tagged at
a year ago