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?
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.