diff --git a/contains-duplicate/Lustellz.ts b/contains-duplicate/Lustellz.ts new file mode 100644 index 000000000..c3250a573 --- /dev/null +++ b/contains-duplicate/Lustellz.ts @@ -0,0 +1,7 @@ +function containsDuplicate(nums: number[]): boolean { + let tmp: number[] = nums.toSorted() + for(let i = 0 ; i < nums.length - 1 ; i++){ + if(tmp[i]===tmp[i+1]) return true + } + return false +}; diff --git a/two-sum/Lustellz.ts b/two-sum/Lustellz.ts new file mode 100644 index 000000000..6a8758c3c --- /dev/null +++ b/two-sum/Lustellz.ts @@ -0,0 +1,6 @@ +function twoSum(nums: number[], target: number){ + for(let i = 0; i < nums.length; i++){ + for(let j = i+1; nums.length-j;j++) + if(nums[j] === target - nums[i]) return [i, j] + } +};