What does the input "[],[1]" mean if A's size >=m+n.

  • 0

    The size of A is larger or equal to m+n.

    I believe that an empty A should be expressed like

    int A[]={0,0,0,0,0,0,0}
    int m=0;
    //if n is 7

    So basically, there is no empty A, is that right?


  • 1

    That's not quite correct, I think. Technically, if both m and n are 0, then A would be empty. However, I'm pretty sure that isn't a test case.

    The inputs are representations of the starting arrays, not the data types. They only show the first m elements of A, and the first n elements of B (which is all of it). If you were to traverse the array A, you would find the actual array does have exactly m+n elements, but "array" A, which is shown in the input, only has m, so will often be shown as empty while it has n elements in reality.

Log in to reply

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