deno.land / x / masx200_leetcode_test@10.6.5 / decode-string / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
export default function decodeString(s: string): string { if (s.includes("[")) { const d = s.replace(/\d+\[[a-z]+\]/g, (substring) => { const [count, encoded_string] = substring.slice(0, -1).split("["); return encoded_string.repeat(Number(count)); }); return decodeString(d); } else { return s; }}
masx200_leetcode_test

Version Info

Tagged at
a year ago