[LeetCode] Merge Sorted Array (Python)

2024. 2. 27. 10:48자료구조

 

 

 

class Solution:
    def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
        
        N1 = nums1[:m]
        N2 = nums2[:n]
        for i in range(len(N2)):
            N1.append(N2[i])
            
        num1 = sorted(N1)
        
        for i in range(len(num1)):
            nums1[i] = num1[i]
        """
        Do not return anything, modify nums1 in-place instead.
        """