티스토리 뷰
Solution in Javascript
const p = [4, 2, 5, 1, 3];
function permutationEquation(p) {
const arr=[];
for (let i = 1; i <= p.length; i++) {
arr.push(p.indexOf(p.indexOf(i)+1)+1);
}
console.log(arr);
}
permutationEquation(p);
Reference
www.hackerrank.com/challenges/permutation-equation/problem
'Algorithms' 카테고리의 다른 글
Equalize the Array (0) | 2020.12.11 |
---|---|
Invert Binary Tree (0) | 2020.11.30 |
Viral Advertising (0) | 2020.10.22 |
Angry Professor (0) | 2020.10.19 |
Beautiful Days at the Movies (0) | 2020.10.18 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- HashMap
- string class in java
- hackerrank javascript
- rest parameter
- Collection Framework
- equals()
- hackerrank javascript solution
- repeat()
- algorithm
- hackerrank
- HackerRank Algorithm
- substring()
- 프로그래머스 알고리즘문제
- ... in Javascript
- compareTo()
- javascript
- math.abs
- hackerrank solution
- 프로그래머스 알고리즘
- 알고리즘
- 프로그래머스
- easy javascript algorithm
- java
- easy algorithm
- spring boot application
- Javascript Algorithm
- C++
- Object type casting
- code refactoring
- math.max
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함