A group of friends wants to buy a bouquet of flowers. The florist wants to maximize his number of new customers and the money he makes. To do this, he decides he'll multiply the price of each flower by the number of that customer's previously purchased flowers plus 1. The first flower will be original price, (0 + 1) * original price, the next will be (1 + 1) * original price and so on. Given the..
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..
Flipping bits | HackerRank Flip bits in its binary representation. www.hackerrank.com You will be given a list of 32 bit unsigned integers. Flip all the bits ( and ) and print the result as an unsigned integer. For example, your decimal input n = 9(10) = 1001(2). We're working with 32 bits, so: 00000000000000000000000000001001(2) = 9(10) 11111111111111111111111111110110(2) = 4294967286(10) 풀이 fu..
Day 6: Bitwise Operators | HackerRank Apply everything we've learned in this bitwise AND challenge. www.hackerrank.com We define S to be a sequence of distinct sequential integers from 1 to n; in other words, S = {1, 2, 3,..., n}. We want to know the maximum bitwise AND value of any two integers, a and b (where a < b), in sequence S that is also less than a given integer, k. Complete the functio..
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..
Given an array of integers, find the sum of its elements. For example, if the array ar=[1, 2, 3], 1 + 2 + 3 = 6, so return 6. Function Description Complete the simpleArraySum function in the editor below. It must return the sum of the array elements as an integer. simpleArraySum has the following parameter(s): ar: an array of integers Simple Array Sum | HackerRank Calculate the sum of integers i..
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
- 리액트
- Array
- 시분할시스템
- Typescript
- 멀티프로그래밍
- 1day1algorithm
- Webpack
- 타입스크립트
- 배치처리시스템
- sort
- Props
- 구간합
- redux-saga
- 프로그래머스
- js
- 배열
- reduce()
- 알고리즘
- sort()
- 자바스크립트
- Algorithm
- 웹팩
- 우아한테크러닝
- 운영체제
- OS
- 자료구조
- greedyAlgorithm
- React
- 컴퓨터공학
- javascript
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |