We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
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.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #105: Special subset sums: testing
You are viewing a single comment's thread. Return to all 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.