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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 3ms, memory 17.3MB, accepted 2025-12-30.
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