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.
For C/C++, there should at least be a test case where prod is so big that the value of Fib(n) * Fib(n+1) overflows the unsigned long long.
It's an unincluded edge case.
What happens if prod is MAX_UNSIGNED_LONG_LONG?
The while loop will never break (or you'll get ull overflow error)
This comment is hidden because it contains spoiler information about the solution
This fails on this test:
(5, [1, 2, 3, 4, 5], 0, szout)
You will return 1 2 3 4 5 array with size 5, when youshould've returned an empty array.
Char, in C/C++ is ASCII, so it will ALWAYS be size one. Thus checking if it's a unicode or not is unnecessary.
This comment is hidden because it contains spoiler information about the solution
After finding prime p with another prime at p + g, your program checks next g numbers for in-between primes, but if it actaully finds prime in-between, then that check is redundant since the outer for loop will go over it anyway.
So, your program basically does some extra looping.
This concatenates whole array k times for no reason. Code is smaller but slower than needed.
count_if seems that it should actually be slower than a simple for loop, unless it inlines the passed function.
Even then, it can't be faster than a simple for loop, and usually for loop is easier to read.
So what makes "count_if" better than a simple for loop?