[HackerRank][Python3] Sequence Equation
2018. 9. 5. 22:06 |
프로그래밍/HackerRank
Problem :
https://www.hackerrank.com/challenges/permutation-equation/problem
My Solution :
#!/usr/bin/env python3 def permutation_equation(p): index_dic = {} for index, num in enumerate(p, start=1): index_dic[num] = index for num in range(1, len(p)+1): yield index_dic[index_dic[num]] n = int(input()) p = list(map(int, input().rstrip().split())) result = permutation_equation(p) for res in result: print(res)
'프로그래밍 > HackerRank' 카테고리의 다른 글
[HackerRank][Python3] Minimum Distances (0) | 2018.09.06 |
---|---|
[HackerRank][Python3] Beautiful Triplets (0) | 2018.09.06 |
[HackerRank][Python3] Equalize the Array (0) | 2018.09.06 |
[HackerRank][Python3] Jumping on the Clouds (0) | 2018.09.06 |
[HackerRank][Python3] String Construction (0) | 2018.09.05 |
[HackerRank][Python3] Beautiful Binary String (0) | 2018.09.05 |
[HackerRank][Python3] Separate the Numbers (0) | 2018.09.04 |
[HackerRank][Python3] Weighted Uniform Strings (0) | 2018.09.04 |
최근에 달린 댓글 최근에 달린 댓글