[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.
"""
'자료구조' 카테고리의 다른 글
[LeetCode] Remove Duplicates from Sorted Array (Python) (0) | 2024.02.27 |
---|---|
[LeetCode] Remove Element (Python) (0) | 2024.02.27 |
[LeetCode] Duplicate Zeros (Python) (0) | 2024.02.27 |
[LeetCode] Squares of a Sorted Array (Python) (0) | 2024.02.27 |
[LeetCode] Find Numbers with Even Number of Digits (Python) (0) | 2024.02.27 |