deno.land / x / masx200_leetcode_test@10.6.5 / optimal-partition-of-string / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export default function partitionString(s: string): number { let set = 0; let res = 0; for (const c of s) { if ( set & (1 << c.charCodeAt(0) - "a".charCodeAt(0)) ) { res++;
set = 0; }
set |= 1 << c.charCodeAt(0) - "a".charCodeAt(0); } return res + 1;}
masx200_leetcode_test

Version Info

Tagged at
a year ago