What's the difference between [[1, 2]] and [[1,2]]


  • 0
    J

    I know there is a space in the former one. And the former one is my output. I want to know why there is a space in it?


  • 2
    M

    The most likely cause is that you aren't actually returning it when it gathers your output. If you have a print statement in your code, the judge will take that result instead of what is returned and use that to compare with the expected value. While the printed version of an array and the array look the same when printed, one is a string and the other is an array in comparison, so you get "Wrong answer".

    Search your code for print statements and remove them, and you should pass this test case.


  • 0
    J

    Thank you! It works.


Log in to reply
 

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