Ad
  • Custom User Avatar

    bruh why the hell my program keeps popping up executed time out. like i already optimized it as many times but it keeps appearing

  • Custom User Avatar

    I don't understand this part of the instruction "If there are two or more pairs with the required sum, the pair whose second element has the smallest index is the solution.". Did I miss something? My Code works but when attempting to submit, it always time out.

  • Custom User Avatar
  • Default User Avatar

    There are dynamic problems of same difficulty at 6 kyu and some that are way harder at 5 kyu, good problem nonetheless.

  • Custom User Avatar

    Agree! Description needs an update)

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    No, the numbers can be duplicated, but you need to return different indices, that means, you return the index of two different elements of the array. See this example:

    sum_pairs([4, 3, 2, 3, 4],         6)
    #          ^-----^         4 + 2 = 6, indices: 0, 2 *
    #             ^-----^      3 + 3 = 6, indices: 1, 3
    #                ^-----^   2 + 4 = 6, indices: 2, 4
    #  * the correct answer is the pair whose second value has the smallest index
    == [4, 2]
    

    You don't use the same 3 twice, right?

  • Custom User Avatar

    I don't get it.

    Python

    First test is sum_pairs([1, 4, 8, 7, 3, 15], 8) should return [1, 7]. But duplicates are allowed and and second index (=1 in case of [4, 4]) are smaller than expected (second index=3 in case of [1, 7]). So duplicates are allowed only if there are no other solutions?

  • Custom User Avatar

    ah ok, so only full subsets should be ignored.

  • Custom User Avatar

    "Per reading list". So you can't have duplicates in each list, but different lists can contain the same book.

  • Custom User Avatar

    After some time somehow solved it. Nice kyu.

  • Custom User Avatar

    How do you determine in which list a book goes if multiple options are available on tie breaker?

    For instance Book 1 - 2 words, Book 2 - 3 words, Book 3 - 3 words, threshold 5 -> Book 1 and 2 together, or Book 1 and 3 together?

    Each book should only be used once per reading list. 
    
  • Custom User Avatar

    Since there is a performance tag, the input size should be provided.

  • Custom User Avatar

    NO random tests in

    • Elixir
    • JS
    • Ruby
    • Rust
    • TS
  • Custom User Avatar

    Python Completions 9079

    No, your code is too slow. And to print and see the input when your code times out, use print(some_var, flush=True) Not sure if it will help here, but...

  • Loading more items...