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

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export default function decodeMessage(key: string, message: string): string { const map = new Map<string, string>([[" ", " "]]); const raw = "abcdefghijklmnopqrstuvwxyz"; let index = 0; for (const char of key) { if (map.has(char)) { continue; } if (key === " ") continue; map.set(char, raw[index]); index++; } return Array.prototype.map .call(message, (char) => map.get(char) ?? char) .join("");}
masx200_leetcode_test

Version Info

Tagged at
a year ago