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
  • Apply
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Recursion
  4. Repetitive K-Sums
  5. Discussions

Repetitive K-Sums

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 28 Discussions, By:

recency

Please Login in order to post a comment

  • thecodingsoluti2
    10 months ago+ 0 comments

    Here is Repetitive K-Sums problem solution in Python Java C++ and c programming - https://programs.programmingoneonone.com/2021/07/hackerrank-repetitive-k-sums-problem-solution.html

    0|
    Permalink
  • alex_fotland
    3 years ago+ 0 comments

    This problem doesn't test the performance of your solution nearly as much as I was expecting. I was expecting to pass half of the test cases at most on my first submission, since I hadn't optimized it at all yet, but it turns out unoptimized is good enough.

    -1|
    Permalink
  • MarcsLab
    3 years ago+ 0 comments

    If there are several possible outputs you can output any of them.

    The verification seems picky about which duplications are OK!?

    0|
    Permalink
  • m0144
    4 years ago+ 0 comments

    Would love an example where k > 2 and n > 1. How is 3-sum done?

    n = 4
    k = 3
    a[1]+a[1]+a[1]? Then what?
    a[1]+a[1]+a[2]
    a[1]+a[1]+a[3]
    a[1]+a[1]+a[4]
    a[1]+a[2]+a[2]
    a[1]+a[2]+a[3]
    a[1]+a[2]+a[4]
    a[1]+a[3]+a[3]
    a[1]+a[3]+a[4]
    a[1]+a[4]+a[4]
    a[2]+a[2]+a[2]
    a[2]+a[2]+a[3]
    a[2]+a[2]+a[4]
    a[2]+a[3]+a[3]
    a[2]+a[3]+a[4]
    a[2]+a[4]+a[4]
    a[3]+a[3]+a[3]
    a[3]+a[3]+a[4]
    a[3]+a[4]+a[4]
    a[4]+a[4]+a[4]
    
    -1|
    Permalink
  • ssjgz
    4 years ago+ 0 comments

    With T apparently only limited to 10**5 and a limit of 10**5 items in an input sequence, there's a possibility that we'd have to read in 10**10 numbers, which would almost certainly not be possible in the given time.

    Though it's mostly common-sense, most problems would mention this constraint explicitly, so here goes:

    None of the testcases (I've tried them all!) require you to read in more than 100000 input sequence elements totalled across all T of that testcases' input sequences (in fact, 98280 (testcase 04) seems to be the largest total number of input sequence elements you'll need to read in).

    In fact (spoiler!) - no testcase has T > 100!

    0|
    Permalink
Load more conversations

Need Help?


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