티스토리 뷰
Calculate and print the sum of the elements in an array, keeping in mind that some of those integers may be quite large.
A Very Big Sum | HackerRank
Calculate the sum of the values in an array that might exceed the range of int values.
www.hackerrank.com
풀이
function aVeryBigSum(ar) {
return ar.reduce((acc, cur) => acc + cur);
}
너모 쉬운 문제여따,, 주어진 Array 값들을 모두 합치는거라 간단하게 reduce 함수를 씀. 끝!
'1Day 1Algorithm' 카테고리의 다른 글
[DAY 9] Max Min (0) | 2019.10.09 |
---|---|
[DAY 8] Greedy Florist (0) | 2019.10.08 |
[DAY 6] Recursion: Fibonacci Numbers (0) | 2019.10.06 |
[DAY 5] Flipping bits (0) | 2019.10.05 |
[DAY 4] Bitwise Operators (0) | 2019.10.04 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 멀티프로그래밍
- 컴퓨터공학
- js
- Props
- Algorithm
- 운영체제
- javascript
- 자바스크립트
- 시분할시스템
- OS
- sort
- 프로그래머스
- 자료구조
- sort()
- 웹팩
- 타입스크립트
- 리액트
- 배치처리시스템
- Typescript
- Array
- React
- redux-saga
- Webpack
- 구간합
- reduce()
- greedyAlgorithm
- 1day1algorithm
- 알고리즘
- 배열
- 우아한테크러닝
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
글 보관함