The testcases are unfair. An comparison between my solution and the first-place solution using a new testcase.

  • 0

    We should add a new testcase as follows:
    ["a"*599998+"b", "a"]

    I cannot test this testcase because it causes MLE. But with a 10 times simplified testcase ["a"*50000+"b", "a"], my solution (which causes TLE during the contest) can complete with a runtime of 220ms but the first-place solution will cause TLE.

    I agree with what nyunyunyunyu posted on
    At least many of the accepted solutions will not be able to pass a testcase like this.
    Leetcode should at least add a testcase like this and then determine the run-time limit.

  • 0

    In Leetcode, the test cases are all run sequentially, and the total time of all cases must be low enough to pass. I basically agree that with the current rules it is a guessing game, though I think Leetcode is taking steps to try to soften that problem.

    The solution I and many others gave during the contest is a dp on the length of the word. I believe due to the straightforwardness of the problem, this was the solution intended (and not two solutions wrapped in an if/then.) If instead you have some sort of iteration on the list of words, then obviously with a list of 2 words you can do faster on those cases, but in the cases where there are 10000 words of length 60, you may go slower. That doesn't mean the solution is better or worse, it just is. FWIW, in many other contests I guessed the wrong solution approach and racked up penalties. My idea was to submit such a dp which in my estimation would probably succeed, and then if it was judged TLE to go and write an if/then to iterate on words when len(words) is low.

    I agree with the current ruleset which is that once a question is judged AC, for the purposes of the contest that result stands. It is the ruleset most friendly to new competitors and the one that is most understandable. It is more unfair to show a contestant AC and then take away that result. It also gets murky, for example if we know that AC's can be taken away, then one might spend the next 90 minutes after completing all problems, to try to debug their programs.

  • 0


    I am not against your solution. Your solution is definitely good and I can learn a lot from it. I just want make the problem and testcases complete. I don't think Leetcode should set a run-time limit that the solution from Leetcode themselves might get TLE with some legal testcases.

Log in to reply

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