티스토리 뷰
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
- 프로그래머스 알고리즘
- Javascript Algorithm
- javascript
- HashMap
- substring()
- java
- 알고리즘
- hackerrank solution
- 프로그래머스 알고리즘문제
- spring boot application
- rest parameter
- easy algorithm
- easy javascript algorithm
- hackerrank
- repeat()
- code refactoring
- math.max
- math.abs
- equals()
- Object type casting
- HackerRank Algorithm
- Collection Framework
- algorithm
- hackerrank javascript
- string class in java
- 프로그래머스
- compareTo()
- C++
- ... in Javascript
- hackerrank javascript solution
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함