deno.land / x / masx200_leetcode_test@10.6.5 / encode-and-decode-tinyurl / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export function encode(longUrl: string): string { if (longtoshort.has(longUrl)) { return longtoshort.get(longUrl) || ""; } longtoshort.set(longUrl, String(count)); shorttolong.set(String(count), longUrl);
return String(count++);}
export function decode(shortUrl: string): string { return shorttolong.get(shortUrl) || "";}let count = 0;const longtoshort = new Map<string, string>();const shorttolong = new Map<string, string>();
masx200_leetcode_test

Version Info

Tagged at
a year ago