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

    HackerRank

  • |
  • Prepare
  • Certify
  • Compete
  • Hiring developers?
  1. All Contests
  2. ProjectEuler+
  3. Project Euler #103: Special subset sums: optimum
  4. Discussions

Project Euler #103: Special subset sums: optimum

Problem
Submissions
Leaderboard
Discussions

Sort 12 Discussions, By:

recency

Please Login in order to post a comment

  • Piyushgrwl
    3 months ago+ 0 comments

    What my understanding is that we are supposed to calculate near-optimal set, NOT the optimum set. Is that correct?

    Can you someone confirm it by reviewing the following outputs? Surprisingly I am not getting any TLE but Wrong Answers. My best guess is that I am messing up while taking modulo.

    n = 6 : {11, 17, 20, 22, 23, 24}
    n = 7 : {22, 33, 39, 42, 44, 45, 46}
    n = 8 : {42, 64, 75, 81, 84, 86, 87, 88}
    n = 9 : {84, 126, 148, 159, 165, 168, 170, 171, 172}
    n = 10 : {165, 249, 291, 313, 324, 330, 333, 335, 336, 337}
    n = 11 : {330, 495, 579, 621, 643, 654, 660, 663, 665, 666, 667}
    
    0|
    Permalink
  • kitchent
    5 years ago+ 0 comments

    I don't know if it's just me, but the test cases for later problems are getting more annoying associated with minor issues of handling large numbers.

    Anyway, I've got an solution for this problem. To arrive at the answer skipping the unneccessary intermediate steps, generate a list of all 's at the beginning (and this is where Python fails on the server without modulo, but not on my machine). It can be achieved easily if you observe the cases for odd and even separately.

    After that, to get to the answer is just a matter of accumulating those 's. You are just one step away when you have the highest element of the answer.

    0|
    Permalink
  • rahulk5
    8 years ago+ 2 comments

    Time out for all test cases in java. Time complexity of my solution is O(n) and space complexity is O(n). Any help ?

    0|
    Permalink
  • vinay149
    8 years ago+ 1 comment

    what will be value of b in this question pls

    0|
    Permalink
  • AashutoshSiddh
    8 years ago+ 0 comments

    int main() { long long int a[MAX][MAX],n,i,j,k,x,temp=0,b; cin>>n; a[0][0]=0; a[1][0]=1; for(i=2;i<=n;i++) temp=i/2; b=a[i-1][temp]; { for(j=0,k=j;j

    Why it is showing output as: 0 0 0 0 0 0

    -1|
    Permalink
Load more conversations

Need Help?


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