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 4b4859b commit 6843903Copy full SHA for 6843903
valid-anagram/whewchews.ts
@@ -9,8 +9,8 @@ function isAnagram(s: string, t: string): boolean {
9
for (let i = 0; i <= s.length - 1; i++) {
10
const sChar = s[i];
11
const tChar = t[i];
12
- count[sChar] = (count[sChar] || 0) + 1;
13
- count[tChar] = (count[tChar] || 0) - 1;
+ count[sChar] = (count[sChar] ?? 0) + 1;
+ count[tChar] = (count[tChar] ?? 0) - 1;
14
}
15
16
// TC: O(N)
0 commit comments