Skip to content

Commit 57acbce

Browse files
hypergadamidoocs
authored andcommitted
style: format code and docs with prettier
1 parent fe4e7b1 commit 57acbce

File tree

1 file changed

+13
-13
lines changed
  • solution/0400-0499/0442.Find All Duplicates in an Array

1 file changed

+13
-13
lines changed
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
function findDuplicates(nums: number[]): number[] {
2-
for (let i = 0; i < nums.length; i++) {
3-
while (nums[i] !== nums[nums[i] - 1]) {
4-
const temp = nums[i];
5-
nums[i] = nums[temp - 1];
6-
nums[temp - 1] = temp;
2+
for (let i = 0; i < nums.length; i++) {
3+
while (nums[i] !== nums[nums[i] - 1]) {
4+
const temp = nums[i];
5+
nums[i] = nums[temp - 1];
6+
nums[temp - 1] = temp;
7+
}
78
}
8-
}
9-
const ans: number[] = [];
10-
for (let i = 0; i < nums.length; i++) {
11-
if (nums[i] !== i + 1) {
12-
ans.push(nums[i]);
9+
const ans: number[] = [];
10+
for (let i = 0; i < nums.length; i++) {
11+
if (nums[i] !== i + 1) {
12+
ans.push(nums[i]);
13+
}
1314
}
14-
}
15-
return ans;
16-
}
15+
return ans;
16+
}

0 commit comments

Comments
 (0)