Cut the sticks
간단하게는 minimum value 로 each index를 subtract할 수 있는 갯수를 구하는 문제. Solution 1 in Javascript const arr = [5, 3, 2, 2, 2, 8] function cutTheSticks(arr) { //sort the array let sorted = arr.sort(); //set index[0] to a min let min = sorted[0]; console.log(sorted.length); for (let i = 0; i min) { min = sorted[i]; //change min to next shortest min console.log(sorted.le..
Algorithms
2020. 12. 18. 17:39
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- string class in java
- code refactoring
- Collection Framework
- hackerrank
- hackerrank javascript solution
- substring()
- math.max
- HackerRank Algorithm
- 프로그래머스 알고리즘문제
- easy javascript algorithm
- C++
- equals()
- algorithm
- rest parameter
- repeat()
- javascript
- spring boot application
- hackerrank javascript
- 프로그래머스 알고리즘
- Javascript Algorithm
- compareTo()
- math.abs
- 프로그래머스
- hackerrank solution
- easy algorithm
- HashMap
- java
- Object type casting
- 알고리즘
- ... in 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 |
글 보관함