1920. Build-Array-From-Permutation

Question Link

Difficulty: Easy

Super easy problem, the description basically tells you the steps to solve this problem (no problem-solving involved).

class Solution(object):
    def buildArray(self, nums):
        """
        :type nums: List[int]
        :rtype: List[int]
        """
        ans = [0] * len(nums)
        for i, num in enumerate(nums):
            ans[i] = nums[num]

        return ans

Time Complexity: O(n)

Space Complexity: O(n)

Time Taken: 42s