Last active
November 8, 2015 09:31
-
-
Save goesang/c1dac5232abf1ee13d94 to your computer and use it in GitHub Desktop.
3Sum 문제 자바스크립트 해답.
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
var arr = [-1,0 ,1, 2, -1, -4]; | |
for(var i = 0 ; i<arr.length;i++){ | |
var a= arr[i]; | |
for(var j = i ; j<arr.length-1;j++){ | |
var b= arr[j]; | |
for(var k = j ; k<arr.length-2;k++){ | |
var c= arr[k]; | |
if((a<=b && b<=c) &&a+b+c == 0) | |
alert(a+" "+b+" "+c); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment