Skip to content
/ leetcode Public
forked from doocs/leetcode

Commit 35c2690

Browse files
committedApr 13, 2022
feat: add new solution and format code
1 parent db30b17 commit 35c2690

File tree

51 files changed

+470
-229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+470
-229
lines changed
 

‎lcof2/剑指 Offer II 034. 外星语言是否排序/Solution.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ function isAlienSorted(words: string[], order: string): boolean {
66
function compare(str1: string, str2: string): boolean {
77
const n = Math.min(str1.length, str2.length);
88
for (let i = 0; i < n; i++) {
9-
let k1 = str1[i], k2 = str2[i];
9+
let k1 = str1[i],
10+
k2 = str2[i];
1011
if (k1 != k2) return charMap.get(k1) < charMap.get(k2);
1112
}
1213
return n == str1.length;
@@ -15,4 +16,4 @@ function isAlienSorted(words: string[], order: string): boolean {
1516
if (!compare(words[i - 1], words[i])) return false;
1617
}
1718
return true;
18-
};
19+
}

‎lcof2/剑指 Offer II 042. 最近请求次数/Solution.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ class RecentCounter {
99
ping(t: number): number {
1010
while (this.stack.length && this.stack[0] + 3000 < t) {
1111
this.cnt--;
12-
this.stack.shift()
12+
this.stack.shift();
1313
}
1414
this.cnt++;
1515
this.stack.push(t);
1616
return this.cnt;
1717
}
18-
}
18+
}

0 commit comments

Comments
 (0)