Skip to content

Commit 5c30283

Browse files
authored
Update index.ts
1 parent 6e0b9bb commit 5c30283

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

3sum-closest/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ export default function threeSumClosest(
22
nums: number[],
33
target: number
44
): number {
5-
let N = nums.length;
5+
const N = nums.length;
66
let res = Number.MAX_SAFE_INTEGER;
77
nums.sort((a, b) => a - b);
88
for (let i = 0; i < N; i++) {
99
let left = i + 1;
1010
let right = N - 1;
1111
while (left < right) {
12-
let sum = nums[i] + nums[left] + nums[right];
12+
const sum = nums[i] + nums[left] + nums[right];
1313
if (Math.abs(sum - target) < Math.abs(res - target)) {
1414
res = sum;
1515
}

0 commit comments

Comments
 (0)