Input: [1,1,1,2] Output: [1,1,1] Expected: [1,1,2] Can someone explain this testcase to me?


  • 0
    H

    Input: [1,1,1,2] Output: [1,1,1] Expected: [1,1,2] Can someone explain this testcase to me?


  • 0

    I wonder it, too.
    I've tried so many times and many ways but always get [1,1,1].


  • 0

    @hangdu it can duplicate twice. So you can image that input => 1, 1, 1, 2 and final array would become 1, 1, 2, 2. The output (length) is 3. That's why expected result is 1, 1, 2.


Log in to reply
 

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