I’m new to programming and I’m trying Leetcode. The question asks to store the answer inside nums1. When I print nums1, the stdout shows the correct answer but the output is not the same?
class Solution(object):
def merge(self, nums1, m, nums2, n):
"""
:type nums1: List[int]
:type m: int
:type nums2: List[int]
:type n: int
:rtype: None Do not return anything, modify nums1 in-place instead.
"""
for x in range(n):
nums1.remove(0)
nums1 = nums1 + nums2
nums1.sort()
print(nums1)
This is what it shows:
You need to sign in to view this answers
Leave feedback about this