mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-07 15:45:40 +08:00
Update 0001.两数之和.md
Add a break statement to break the for-loop in the Typescript solution.
This commit is contained in:
@ -349,6 +349,7 @@ function twoSum(nums: number[], target: number): number[] {
|
||||
index = helperMap.get(target - nums[i]);
|
||||
if (index !== undefined) {
|
||||
resArr = [i, index];
|
||||
break;
|
||||
}
|
||||
helperMap.set(nums[i], i);
|
||||
}
|
||||
|
Reference in New Issue
Block a user