Question on test case input format for two dimensional char arrays

  • 10

    Since the input is a two dimensional char array, I wrote my test case as:

    [['1', '0', '0', '0'], ['0', '1', '1', '1'], ['0', '0', '1', '0'], ['0', '0', '0', '1']]

    I got the following results:
    Run Code Status: Runtime Error

    Run Code Result:

    Your input

    [['1', '0', '0', '0'], ['0', '1', '1', '1'], ['0', '0', '1', '0'], ['0', '0', '0', '1']]
    Your answer

    Expected answer

    Runtime: N/A

    Then, I changed the input to: [“1000”, “0111”, “0010”, “0010”]; this time everything is good. It did not take me too much time to realize that the input should be changed as so, because I encountered similar issues before for other problems.

    Though the first format for two dimensional char array is correct, I personally prefer the second format, because the second format requres less typing.

    My concern is that, LeetCode should indicate somewhere that, the second format is what LeetCode accepts. Otherwise, people who think the first format is the only correct format will get confused, especially the people who first encountered this issue.

Log in to reply

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