Sort 4 Discussions, By:
Please Login in order to post a comment
That's weird ... I wrote a valid algorithm to check a set but it's O(n^2) and just too slow to verify a big set. Therefore I added a shortcut: always return "NO" whenever a set has 30+ elements. I got a final score of 100% :-)
I found a 6-codeline Python3 solution that is robust — no ad-hoc hacks for size > 20 or 30.
For the case of B and C having the same size, rigorously think about minimal and maximal counter-examples. It may be helpful to sort the list A. If B and C don't have the same size, I used math logic that didn't directly check if they're disjoint, but rather a consequence of it.
Can t seem to be able to pass test 14.
all sets are 20 max elements.
Updated: Counter over defaultdict, seem to pass.
Good luck who you come after.
Am I right to think that subsets of length 1 (singletons) are not taken into account ?
No more comments