Created
January 22, 2018 08:51
-
-
Save theand/02208196f062412d28a68bc545e8b4b1 to your computer and use it in GitHub Desktop.
정수 배열(int array)가 주어지면 가장 큰 이어지는 원소들의 합을 구하시오
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 array1 = [-1, 3, -1, 5]; | |
var array2 = [-5, -3, -1]; | |
var array3 = [2, 4, -2, -3, 8]; | |
const map1 = array3.map( (e,i,a) => { | |
return a.slice(i).reduce( (a, b) => a+b, 0); | |
}); | |
console.log(Math.max(...map1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
시간 복잡도 1은 처리하기 귀찮아서 스킵.