Difficulty
Easy
Language
Python
Solution 1 - Insert at Index
Iterate through nums/index pairs and insert into target.
""" 1389.1 - Create Target Array in the Given Order - Solution 1 - Insert """
from typing import List
class Solution:
def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
out: List[int] = []
for x, i in zip(nums, index):
out.insert(i, x)
return out