Solution in JavaScript I const s = 7; const t = 10; const a = 4; const b = 12; const apples = [2, 3, -4]; const oranges = [3, -2, -4]; function countApplesAndOranges(s, t, a, b, apples, oranges) { let k = 0; let j = 0; let i; for (i = 0; i = s && a + apples[i] = s && b + oranges[i] value + a >= s && value + a value + b >= s && value + b
Solution in JavaScript const grades = [73, 67, 38, 33]; function gradingStudents(grade) { for (let i = 0; i = 38) { if (grade[i] % 5 === 3) { grade[i] += 2 } else if (grade[i] % 5 === 4) { grade[i] += 1 } } } return grade; } console.log(gradingStudents(grades)); //[ 75, 67, 40, 33 ] Reference https://www.hackerrank.com/challenges/grading/problem Grading Stude..
Solution in JavaScript const s = '07:05:45PM'; function TimeConversion(s) { // string을 바꿀 수 없으니 split을 사용해서 array로 바꿔준다. // AM과 PM도 삭제. '00:00:00AM' -> ['00', '00', '00'] //const arr = s.slice(0, 8).split(':'); const arr = s.split(':'); //indexOf(): 원하는 element의 index number return하고 원하는 index가 없으면 -1 return //PM 이 존재하면 최소 0 이니까 조건을 '> -1' 로 준다. //min 과 sec은 같고 시간 즉 arr[0]만 변화주면됨. arr[0] = (s.in..
Problem You are in charge of the cake for your niece's birthday and have decided the cake will have one candle for each year of her total age. When she blows out the candles, she’ll only be able to blow out the tallest ones. Your task is to find out how many candles she can successfully blow out. For example, if your niece is turning 4years old, and the cake will have 4candles of height 4,4,1,3 ..
Problem Given five positive integers, find the minimum and maximum values that can be calculated by summing exactly four of the five integers. Then print the respective minimum and maximum values as a single line of two space-separated long integers. Example let arr = [1, 3, 5, 7, 9] The minimum sum is 1 + 3 + 5 + 7 = 16 and the maximum sum is 3 + 5 + 7 + 9 = 24. The function prints 16 24 Soluti..
- Total
- Today
- Yesterday
- java
- equals()
- math.max
- algorithm
- hackerrank solution
- Javascript Algorithm
- hackerrank javascript
- 프로그래머스
- rest parameter
- C++
- substring()
- Object type casting
- ... in Javascript
- 프로그래머스 알고리즘문제
- compareTo()
- math.abs
- javascript
- string class in java
- easy algorithm
- spring boot application
- HashMap
- hackerrank javascript solution
- 프로그래머스 알고리즘
- easy javascript algorithm
- code refactoring
- HackerRank Algorithm
- 알고리즘
- Collection Framework
- hackerrank
- repeat()
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |