We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 029cf34 commit f73b844Copy full SHA for f73b844
README.md
@@ -10,6 +10,8 @@ leetcode 测试
10
11
##### 包含的内容如下
12
13
+https://leetcode.cn/problems/longest-uploaded-prefix/
14
+
15
https://leetcode.cn/problems/find-mode-in-binary-search-tree/
16
17
https://leetcode.cn/problems/split-a-string-in-balanced-strings/
longest-uploaded-prefix/index.ts
@@ -0,0 +1,21 @@
1
+class LUPrefix {
2
+ #n: number;
3
+ #ptr = 1;
4
+ #uploaded: Set<number> = new Set();
5
+ constructor(n: number) {
6
+ this.#n = n;
7
+ }
8
9
+ upload(video: number): void {
+ this.#uploaded.add(video);
+ while (this.#ptr <= this.#n && this.#uploaded.has(this.#ptr)) {
+ ++this.#ptr;
+ longest(): number {
18
+ return this.#ptr - 1;
19
20
+}
21
+export default LUPrefix;
0 commit comments