Hackerrank – Sequence Equation

Hackerrank – Problem Statement

A description of the problem can be found on Hackerrank.

Solution

I have given count of numbers n.
I will iterate over all numbers from 1 to n
I will find index of each iterated number in all elements and then index of index within all elements

I created solution in:

All solutions are also available on my GitHub profile.

Scala

Java

Javascript

One thought on “Hackerrank – Sequence Equation

  1. Here is a solution for Python:
    def permutationEquation(p):
    return [(p.index(p.index(i)+1)+1) for i in range(1, max(p)+1)]

Leave a Reply

Your email address will not be published. Required fields are marked *