Hi and thanks for your reply. This looks like a very good solution.
Wouldn't this have O(n^2) time complexity?
Indeed this algorithm would have an O(n²) time complexity if the xs list would remain the same. I believe the time complexity is O(n log n) since we are decreasing the xs list each time in the solution I proposed. But I'm bad at time complexity so I wouldn't know.
I didn't know about Data.IntSet I'll look into that. Thanks for sharing.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi and thanks for your reply. This looks like a very good solution.
Indeed this algorithm would have an
O(n²)
time complexity if thexs
list would remain the same. I believe the time complexity isO(n log n)
since we are decreasing thexs
list each time in the solution I proposed. But I'm bad at time complexity so I wouldn't know.I didn't know about
Data.IntSet
I'll look into that. Thanks for sharing.