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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #105: Special subset sums: testing
  4. Discussions

Project Euler #105: Special subset sums: testing

Problem
Submissions
Leaderboard
Discussions

Sort 4 Discussions, By:

votes

Please Login in order to post a comment

  • qayum_khan_usa
    2 years ago+ 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 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.

    0|
    Permalink
  • padeff
    4 years ago+ 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.

    0|
    Permalink
  • stbrumme
    5 years ago+ 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% :-)

    0|
    Permalink
  • quesnoit
    7 years ago+ 1 comment

    Am I right to think that subsets of length 1 (singletons) are not taken into account ?

    0|
    Permalink

No more comments

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature