Problem Solving/LeetCode

Today's Challenge

fabichoi 2022. 6. 7. 23:45

https://leetcode.com/problems/merge-sorted-array/

 

Merge Sorted Array - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com

Easy 난이도이긴 한데.. 뭔가 특이한 문제 =_=
return값도 따로 없고 그냥 기존 리스트에 값을 넣어라고 하고 ㅋㅋ
로직 자체가 어려운 건 아니었음.

class Solution:
    def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None: 
        idx = 0
        for i in range(m, len(nums1)):
            nums1[i] = nums2[idx]
            idx += 1
        nums1.sort()
반응형