Why C code runs slower than C++/java in this problem?


  • 2
    J

    Accepted Solutions Runtime Distribution shows that answers written by pure C is very slow. This is rarely seen in other problems. Can you help me explain it?


  • 0
    E

    Java and Python use data structure list, while C and C++ use array. This problem needs inserting and deleting object from the container. And searching is less important. So list is more efficient than array.


Log in to reply
 

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