LeetCode solutions

1505. Create Target Array in the Given Order

My accepted Python solution to LeetCode problem 1505, Create Target Array in the Given Order, running in 3ms.

  • Difficulty: Easy
  • Python
  • Runtime 3ms
  • Memory 17.3MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 3ms, memory 17.3MB, accepted 2025-12-30.

python
class Solution:
    def createTargetArray(self, nums: List[int], index: List[int]) -> List[int]:
        target = []
        for n, i in zip(nums, index):
            target.insert(i, n)
        return target

Source