Can you just have two pointers at the beginning of both array for O(k) time?

  • 0

    Let's take two arrays:
    [1,7,11] and [2,4,30]. What's wrong with having a pointer at 1 and 2, then at each iteration comparing, for example, (1,4) vs. (7,2). If 1,4 greater than 7,2, we can them compare (1,30) vs 7,2 and continue like this k times?

Log in to reply

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