mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-03 05:27:55 +08:00
Add a test and update ts code style
This commit is contained in:
@ -30,4 +30,13 @@ function twoSumHashTable(nums: number[], target: number): number[] {
|
||||
}
|
||||
}
|
||||
return [];
|
||||
};
|
||||
};
|
||||
|
||||
/* Driver Code */
|
||||
let nums = [2, 7, 11, 15]
|
||||
twoSumBruteForce(nums, 9)
|
||||
console.log("使用暴力枚举后得到结果:", nums)
|
||||
|
||||
let nums1 = [2, 7, 11, 15]
|
||||
twoSumHashTable(nums1, 9)
|
||||
console.log("使用辅助哈希表后得到结果", nums1)
|
||||
Reference in New Issue
Block a user