Why does doing this didn't gave me "Empty string returns True" Error
when i tried it with if statement, same process i got that error
There is no need for TreeSet here. HashSet will be a lot faster. But using ArrayList will be slower, as searching and deletion will take more time in arraylist.
Since Python loops are slow and calls to functions implemented in C are fast, this solution is actually faster.
Average of 10000 tests with Python 3.6, on lists of size 1000 :
two_passes : 0.385ms
one_pass : 0.469ms
Same here! living and learning!
Me, too. But hey! Now we know!