Skip to content

Commit 97b3adf

Browse files
authored
Update solution/0300-0399/0393.UTF-8 Validation/Solution.ts
1 parent ea88cb9 commit 97b3adf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

solution/0300-0399/0393.UTF-8 Validation/Solution.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ function validUtf8(data: number[]): boolean {
22
let cnt = 0;
33
for (const v of data) {
44
if (cnt > 0) {
5-
if (v >> 6 != 0b10) {
5+
if (v >> 6 !== 0b10) {
66
return false;
77
}
88
--cnt;
9-
} else if (v >> 7 == 0) {
9+
} else if (v >> 7 === 0) {
1010
cnt = 0;
11-
} else if (v >> 5 == 0b110) {
11+
} else if (v >> 5 === 0b110) {
1212
cnt = 1;
13-
} else if (v >> 4 == 0b1110) {
13+
} else if (v >> 4 === 0b1110) {
1414
cnt = 2;
15-
} else if (v >> 3 == 0b11110) {
15+
} else if (v >> 3 === 0b11110) {
1616
cnt = 3;
1717
} else {
1818
return false;
1919
}
2020
}
21-
return cnt == 0;
21+
return cnt === 0;
2222
}

0 commit comments

Comments
 (0)