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.

Loading...

# Project Euler #105: Special subset sums: testing

# Project Euler #105: Special subset sums: testing

stbrumme + 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% :-)

wesnerm + 0 comments Well, the range of values of a set of 2 elements is 2*10^6 and there are n*(n-1)/2 sets of 2 elements; it takes a little over 1000 to exceed the range. If every subset has a distinct value, than there are 2^n-1 distinct values or at least 2^30-1, in your case. That's larger than the range of any subset, which is n <= range <= n*10^6.

padeff + 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.

No more comments

Sort 3 Discussions, By:

Please Login in order to post a comment