Created
June 14, 2021 17:30
-
-
Save fullstuck/ff9785b9fdd2f68179b862995e6d9330 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function twoSums(nums, target){ | |
| let start = 0; | |
| for(let i = 1; i < nums.length; i++){ | |
| let curr = nums[start]; | |
| if(curr + nums[i] == target) | |
| return [start, i] | |
| if(i == nums.length - 1){ | |
| start++ | |
| i = start | |
| } | |
| } | |
| return -1 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment