Skip to content

Commit 84202b1

Browse files
committed
chore: add brackets for conditional expression
1 parent dcb0e1a commit 84202b1

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

typescript/src/insertDeleteGetRandom/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,19 @@ class RandomizedSet {
4444
}
4545

4646
insert(val: number): boolean {
47-
if (this.map.has(val)) return false;
47+
if (this.map.has(val)) {
48+
return false;
49+
}
50+
4851
this.map.set(val, this.list.length);
4952
this.list.push(val);
5053
return true;
5154
}
5255

5356
remove(val: number): boolean {
54-
if (!this.map.has(val)) return false;
57+
if (!this.map.has(val)) {
58+
return false;
59+
}
5560

5661
const index = this.map.get(val) as number;
5762
const lastElement = this.list[this.list.length - 1];

typescript/src/insertDeleteGetRandom/randomizedSet.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,19 @@ export class RandomizedSet {
88
}
99

1010
insert(val: number): boolean {
11-
if (this.map.has(val)) return false;
11+
if (this.map.has(val)) {
12+
return false;
13+
}
14+
1215
this.map.set(val, this.list.length);
1316
this.list.push(val);
1417
return true;
1518
}
1619

1720
remove(val: number): boolean {
18-
if (!this.map.has(val)) return false;
21+
if (!this.map.has(val)) {
22+
return false;
23+
}
1924

2025
const index = this.map.get(val) as number;
2126
const lastElement = this.list[this.list.length - 1];

0 commit comments

Comments
 (0)