My LeetCode grinding. Trying to do a problem a day.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

main.py 300B

1234567891011
  1. class Solution:
  2. def shuffle(self, nums, n):
  3. shuffled = []
  4. for a in range(n):
  5. shuffled.append(nums[a])
  6. shuffled.append(nums[a + n])
  7. return shuffled
  8. s = Solution()
  9. print("Expected: [2, 3, 5, 4, 1, 7]")
  10. print("Got:", s.shuffle([2, 5, 1, 3, 4, 7], 3))