티스토리 뷰
Solution in Javascript
const k = 4;
const height = [1, 6, 3, 5, 2];
function hurdleRace(k, height) {
const max = Math.max(...height);
if ((max - k) <= 0){
console.log(0);
}else{
console.log(max - k);
}
}
hurdleRace(k, height);
Reference
www.hackerrank.com/challenges/the-hurdle-race/problem
The Hurdle Race | HackerRank
Determine the maximum value in an array less a value, limit >= 0.
www.hackerrank.com
'Algorithms' 카테고리의 다른 글
Utopian Tree (0) | 2020.10.01 |
---|---|
Electronics Shop (0) | 2020.09.25 |
Cats and a Mouse (0) | 2020.09.17 |
Find Digits (0) | 2020.09.13 |
Bon Appétit (0) | 2020.09.12 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- algorithm
- rest parameter
- spring boot application
- ... in Javascript
- 알고리즘
- substring()
- compareTo()
- hackerrank solution
- HackerRank Algorithm
- code refactoring
- math.abs
- hackerrank
- 프로그래머스 알고리즘문제
- Collection Framework
- math.max
- C++
- easy algorithm
- easy javascript algorithm
- repeat()
- HashMap
- javascript
- hackerrank javascript solution
- Object type casting
- java
- Javascript Algorithm
- hackerrank javascript
- 프로그래머스 알고리즘
- 프로그래머스
- equals()
- string class in java
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함