Project Euler #105: Special subset sums: testing
Project Euler #105: Special subset sums: testing
+ 0 comments I found a 6-codeline Python3 solution that is robust — no ad-hoc hacks for size > 20 or 30.
For the case of
B
andC
having the same size, rigorously think about minimal and maximal counter-examples. It may be helpful to sort the listA
. IfB
andC
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.
+ 0 comments 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.
+ 1 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% :-)
+ 1 comment Am I right to think that subsets of length 1 (singletons) are not taken into account ?
No more comments
Sort 4 Discussions, By:
Please Login in order to post a comment