My LeetCode grinding. Trying to do a problem a day.
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

main.py 303B

12345678910
  1. class Solution:
  2. def createTargetArray(self, nums, index):
  3. result = []
  4. for x in range(len(nums)):
  5. result.insert(index[x], nums[x])
  6. return result
  7. s = Solution()
  8. print("Expected: [0, 4, 1, 3, 2]")
  9. print("Got:", s.createTargetArray([0, 1, 2, 3, 4], [0, 1, 2, 2, 1]))