Why the runtime of using array is much faster then using hashset or hashmap


  • 0
    L

    In the question, we can use array to store elements, and we can also use hashset to store elements. I tried both. The runtime of array is 46ms, the runtime of hashset is 66ms. What makes the difference?


Log in to reply
 

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