Some people are standing in a row in a park. There are trees between them which cannot be moved. Your task is to rearrange the people by their heights in a non-descending order without moving the trees.
Example
For a = [-1, 150, 190, 170, -1, -1, 160, 180]
, the output should besortByHeight(a) = [-1, 150, 160, 170, -1, -1, 180, 190]
.
Code
function sortByHeight(a) {
}
'알고리즘(CF)' 카테고리의 다른 글
14. alternatingSums (1) | 2017.06.17 |
---|---|
13. reverseParentheses (1) | 2017.06.17 |
11. isLucky (1) | 2017.06.08 |
10. commonCharacterCount (1) | 2017.06.08 |
9. allLongestStrings (1) | 2017.06.08 |