I'm wondering what is the reason behind to switch the input parameter from set to list? Isn't the set could check contains in O(1)? But it's interesting that it takes more time if I create a hashset. I think the dictionary is probably not big enough though.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.