Skip to content

Instantly share code, notes, and snippets.

@NhanKhangg98
Created August 28, 2022 09:50
Show Gist options
  • Save NhanKhangg98/27b6af3d82551360493ac5f709884684 to your computer and use it in GitHub Desktop.
Save NhanKhangg98/27b6af3d82551360493ac5f709884684 to your computer and use it in GitHub Desktop.
var twoSum = function(nums, target) {
for (let i = 0; i < nums.length; i++){
for (let j = 0; j < nums.length; j++){
if(nums[i] + nums[j] == target && i !=j) {
return [nums[i], nums[j]];
}
}
}
};
@QuocCao-dev
Copy link

j = i + 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment