Migratory Birds
The solution in Javascript I (Failed in HackerRank) sort 를 이용. 순서대로 정렬해준 후에 동일한 값의 (last index - first index) + 1 (0부터 시작하니까) 해외 블로그 접근이 좋긴했지만 결과적으로 HackerRank에서는 fail. const arr = [1, 2, 3, 4, 5, 4, 3, 2, 1, 3, 4, 1] function migratoryBirds(arr) { let bird = 1; let max = bird; //bird 의 시작이 1이라는 것은 at least one bird id는 존재한다는 의미. 나중에 더 큰 값이오면 대체. let result = 0; arr.sort(); //1,1,1,2,2,3,3,3,4,4..
Algorithms
2020. 10. 1. 23:50
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 프로그래머스 알고리즘문제
- HackerRank Algorithm
- hackerrank javascript solution
- hackerrank javascript
- hackerrank solution
- Object type casting
- 프로그래머스 알고리즘
- C++
- equals()
- ... in Javascript
- math.max
- Javascript Algorithm
- HashMap
- spring boot application
- easy algorithm
- java
- algorithm
- code refactoring
- easy javascript algorithm
- string class in java
- 알고리즘
- rest parameter
- repeat()
- javascript
- math.abs
- Collection Framework
- hackerrank
- compareTo()
- 프로그래머스
- substring()
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함