Skip to content

MedianOfTwoSortedArrayOfDifferentLength.java #302

@kavinda14

Description

@kavinda14

Could someone tell me why input2 has to be longer in length than input1?

I did some examples by hand and this is definitely right, but I am failing to understand the logic behind it.
Is it because when input2 is longer, there is more flexibility in moving the partitions around?

if (input1.length > input2.length) { return findMedianSortedArrays(input2, input1); }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions