Created
April 16, 2019 16:43
-
-
Save 4skinSkywalker/9c4fa2f8e0d28a73f6d1d314f5d4e4d4 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 sumZero(array) { | |
| let left = 0 | |
| let right = array.length - 1 | |
| while (left < right) { | |
| let sum = array[left] + array[right] | |
| if (sum === 0) | |
| return true | |
| if (sum > 0) | |
| right-- | |
| else | |
| left++ | |
| } | |
| return false | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment