deno.land / x / masx200_leetcode_test@10.6.5 / longest-uncommon-subsequence-ii / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
export default function findLUSlength(strs: string[]): number { return Math.max( -1, ...strs.filter((str1, i) => { const check = strs.every((str, j) => { if (i !== j && isSubseq(str1, str)) { return false; }
return true; });
return check; }).map((str) => str.length), );}
const isSubseq = (s: string, t: string) => { if (s.length > t.length) return false; let ptS = 0, ptT = 0; while (ptS < s.length && ptT < t.length) { if (s[ptS] === t[ptT]) { ++ptS; } ++ptT; } return ptS === s.length;};
masx200_leetcode_test

Version Info

Tagged at
a year ago