Bug in the expexted answer


  • 0
    .

    For input:
    "41023"
    3

    OJ says the Expected answer is "2".
    If this not a bug, can someone explain why not?

    FYI,
    for input:
    "4123"
    2
    Expected answer is "12"


  • 1
    C

    For "41023", and 3, you get "02" by removing '4', '1' and '3', leaving "02". Then you get rid of the leading zeroes so it is "2".


  • 0
    W

    @.manish. You have 5 digits, after removing 3, you get 2 digits remained. We should consider only 02 or 03. Because any other possible ans will have the leading digit of 1 or 4 ect. "02" and "03" are lead by '0'. The ans is "02", that is, "2"


Log in to reply
 

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