Sequence Equation : HackerRank Solution in Python 3.
Nov 17, 2020
Solution in Python 3
Explanation:-
The given list p contains elements which are less than or equal to the length of p and greater than or equal to 1.
First, we will iterate from 1 to len(p)+1 through a variable i and store the index of i occurred in list p in a new list called indices.
Then we will declare a new empty list called ans.
ans = []
Following that, will iterate the elements of list indices through a variable ele and store the index of ele occurred in list p in the list ans.
At the end we will return the list ans.
return ans