About the m and n variables


  • 0
    K

    Input:
    [0]
    0
    [1]
    1
    Output:
    [0,1]
    Expected:
    [1]

    According to the question, nums1 is a sorted list with m initialized elements. But in this test case nums1=[0] but m = 0

    Now look at another test case:

    Your input

    [1,2,3,4]
    2
    [2]
    1
    Your answer

    [1,2,2,4]
    Expected answer

    [1,2,2,4]

    Here, although len(nums) =4 and m =2, so the test case will take the first 2 elements in nums1 into account.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.