Testcase.....


  • 0
    J

    for test case

    ["FileSystem","mkdir","ls","ls","mkdir","ls","ls","addContentToFile","ls","ls","ls"]
    [[],["/goowmfn"],["/goowmfn"],["/"],["/z"],["/"],["/"],["/goowmfn/c","shetopcy"],["/z"],["/goowmfn/c"],["/goowmfn"]]

    shouldn't the result be [null,null,[],["goowmfn"],null,["goowmfn","z"],["goowmfn","z"],null,[],["shetopcy"],["c"]]?


  • 0

    The expected answer is
    [null,null,[],["goowmfn"],null,["goowmfn","z"],["goowmfn","z"],null,[],["c"],["c"]]
    your answer
    [null,null,[],["goowmfn"],null,["goowmfn","z"],["goowmfn","z"],null,[],["shetopcy"],["c"]]

    The difference is the last second "ls", which list "/goowmfn/c". So your answer actually output the content of file c, however, the description says that you need to output the file name.


  • 0
    D

    @Jackjack "If it is a file path, return a list that only contains this file's name."
    The function returns file content is readContentFromFile


  • 0
    J

    @fallcreek I see it now. Thanks.


Log in to reply
 

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