Leetcode 2048 Solution

This article provides solution to leetcode question 2048 (build-array-from-permutation)

https://leetcode.com/problems/build-array-from-permutation

Solution

class Solution:
    def buildArray(self, nums: List[int]) -> List[int]:
        ans = []
        for num in nums:
            ans.append(nums[num])
        return ans