Last active
June 6, 2021 06:44
-
-
Save samandar-boymurodov/b7da20428c99c3d664af590db8d30871 to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* @param {number[]} nums | |
* @param {number} target | |
* @return {number[]} | |
*/ | |
var twoSum = function(nums, target) { | |
for (let [i1, v1] of nums.entries()) { | |
for (let [i2, v2] of nums.entries()) { | |
if (i1 !== i2) { | |
if (v1+v2 === target) return [i1, i2] | |
} | |
} | |
} | |
}; |
Author
samandar-boymurodov
commented
Jun 6, 2021
- I liked this solution written in java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment