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.
Trying to solve this in C#... Simple brute method worked with sample tests, but timed out on the later test.
So i've used the Binet formula which works fine up to n = 10 and fails at n = 100.
I've used double to define phi, psi and sqrt(5), and to do phi^n, and apparently that starts to fail in lesser digits on the number.
What am I missing here?
What's the point of having the number type be
long long
in C++?My solution was
O(N^3)
space complexity and still passed.As was said, limiting the tape length wouldn't really change the difficulty at all, it would just slightly limit the range of solutions available.
Yep
Completely agree with you !!
Fixed by Chrono79
I've fixed the arguments being flipped.
For the original issue, I've spent way more time than I had planned trying to see it it's an issue. I'm going to mark as resolved because I've tried different solutions from different languages and the accepted solutions can handle that test. Not agreeing with other implementation doesn't make this an issue.
According to the CW wiki, "Best Practices" are solutions that you would expect to see in production code. Maintainability and readability are favored over performance and elegance. Of course, in the real world, production code standards will vary. Regardless, this solution reads well, and would be easy to manage due to the granularity.
That's your personal opinion;-)... For me, it's enough...
@smile67 Not a good enough reason for testing against string and double, string culture is a thing!
My feelings exactly.
The test cases are wrong for all even sizes > 2. You should use the above code just before you return the answer.
Presumably because of the comment describing how the pattern was derived
Resolved.
Welp, I've made a Java translation which uses double array and wondered if that was ok for the part 1, cause I'm too lazy to do extra job if it's not entirely necessary.
Loading more items...