Notes
Untitled
Content of the notes (1)
Page 1
var twoSum = function (nums, target) {
for (let i = 0; i < nums.length; i++) {
for (let j = i + 1; j < nums.length; j++) {
if (nums[j] === target - nums[i]) {
return [i, j];
}
}
}
// Return an empty array if no solution is found
return [];
};
Information
- Description
- Informática Note on Untitled, created by Jainner Salcedo Sanchez on 14/01/2025.
- Created by
- Jainner Salcedo Sanchez · Jan 2025
- Updated
- Jan 14, 2025
- Views
- 0
- Rating