[HAI] home work leetcode

This commit is contained in:
2024-11-10 22:03:28 +03:00
parent 427731f797
commit 022f89a537
3 changed files with 47 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
export function missingNumber(nums: number[]) {
let overallSum = 0;
for (let i = 0; i <= nums.length; i++) {
overallSum += i;
}
for (const num of nums) {
overallSum -= num;
}
return overallSum;
};