
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 함수를 씀. 끝!

The Fibonacci Sequence The Fibonacci sequence appears in nature all around us, in the arrangement of seeds in a sunflower and the spiral of a nautilus for example. The Fibonacci sequence begins with fibonacci(0) = 0 and fibonacci(1) = 1 as its first and second terms. After these first two elements, each subsequent element is equal to the sum of the previous two elements. Programmatically: fibona..

Compare the Triplets | HackerRank Compare the elements in two triplets. www.hackerrank.com 풀이 function compareTriplets(a, b) { let result = [0, 0]; for(let i = 0; i b[i]) { result[0] += 1; } else if (a[i] < b[i]) { result[1] += 1; } } return result; } 1. 결과 값을 담을 result 라는 변수를 선언함. 2. for문을 돌면서 a와 b의 값을 비교하고, 값이 큰 사람에게 결과 값 1을 result에 더해줌 3. result를 리턴함 다른 사람의 풀이 function c..

John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are. For example, there are n=7 socks with colors ar=[1,2,1,2,1,3,2]. There is one pair of color 1 and one of color 2. There are three odd socks left, one of each color. The n..
- Total
- Today
- Yesterday
- 멀티프로그래밍
- Webpack
- 시분할시스템
- 프로그래머스
- Typescript
- 배치처리시스템
- 알고리즘
- 자료구조
- 운영체제
- Array
- Algorithm
- js
- OS
- 배열
- 자바스크립트
- 컴퓨터공학
- 타입스크립트
- 우아한테크러닝
- sort
- 1day1algorithm
- greedyAlgorithm
- javascript
- sort()
- 구간합
- React
- 웹팩
- Props
- reduce()
- 리액트
- redux-saga
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |