Why do Java solutions seem to always have the fastest runtimes here?


  • 4
    L

    When looking at runtime distributions of different languages on LeetCode, most of the time Java ones are the fastest. From what I've heard, Java isn't considered a fast language, especially compared to C. Is it just a byproduct of the code engine they use or is Java faster than I thought? I would have guessed Java would be closer to Python/C# (though faster than both).

    Here's an example distribution for Maximum Depth of Binary Tree:

    Solution Runtimes

    (Java in brown, C in grey, and Cpp in pink if you can't see the legend. Then Python, Ruby, and JS/C# in that order).


Log in to reply
 

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