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.
You did not check whether
x
is also an integer. Also, what is the deciding factor in choosingn / 4
as the upper boundary?same code.:)
nice work
well done!
What happen if you set 1 million values in your array?, The for loop make 1 million loops that is a problem for Ram memory
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Can you explain this more detailed, which line causes the error and what can i do?
Not an issue. Don't segfault.
what is the problem with this code? exit code 132
std::pair<std::size_t, std::size_t> two_sum(const std::vector& n, int target) {
for(int i=0,j=n.size()-1;i<j;){
if(n[i]+n[j]>target)j--;
else if(n[i]+n[j]<target)i++;
else return {i,j};
}
}