88. Merge Sorted Array

Обновлено: 2024-03-12
1 мин
[Array Two Pointers Sorting]

Содержание

LeetCode problem

First accepted

class Solution:
    def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:
        """
        Do not return anything, modify nums1 in-place instead.
        """
        i = len(nums1) - n
        for j in nums2:
            nums1[i] = j
            i += 1
        nums1.sort()