Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
bruh why the hell my program keeps popping up executed time out. like i already optimized it as many times but it keeps appearing
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.
There are dynamic problems of same difficulty at 6 kyu and some that are way harder at 5 kyu, good problem nonetheless.
Agree! Description needs an update)
This comment is hidden because it contains spoiler information about the solution
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:
You don't use the same 3 twice, right?
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?ah ok, so only full subsets should be ignored.
"Per reading list". So you can't have duplicates in each list, but different lists can contain the same book.
After some time somehow solved it. Nice kyu.
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?
Since there is a
performance
tag, the input size should be provided.NO random tests in
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...