Why is this wrong output?


  • 0
    C

    Input:
    "a"
    [read(0),read(1),read(2)]
    Output:
    ["","a","a"]
    Expected:
    ["","a",""]

    We were asked to read() call, we were asked to read 2 characters, but since the file has only 1 character, we return the 1 character.


Log in to reply
 

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