7 kyu
Fibonacci
333 of 7,287wichu
Loading description...
Fundamentals
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
This comment has been hidden.
That's because you don't use
input()
here. Read the docs: https://docs.codewars.com/getting-started/solving-kataNot a kata issue.
This comment has been hidden.
This comment has been hidden.
C#: method name should be
PascalCase
(Please refer to implementation of backward compatibility here )This comment has been hidden.
Read this: https://docs.codewars.com/training/troubleshooting/#expected-the-same
Actually it says "Index 1 out of bounds for length 1" in my codewars screen. But it works on Intelijj. I mean it might not be related to troubleshooting.
You're creating an array 1 element shorter that you should. When n is 1 you create an array of length 1 and then try to write two elements in it.
That is good explanation thank you very much!
This comment has been hidden.
Groovy translation
approved
Missing sample and fixed tests for
0
in C and C# making several solutions failLua translation!
Approved!
Thank you!
A simple recursive solution must work in this kata (there are other Fibonacci kata which have performance requirements).
Oh, I based the translation on python's one which checks up to
fibonacci(299)
(way over fib(78) which I choosed in order to fit into a standard ieee758 double's mantissa). That said we can dial down its max limit... fib(35) seems to take around 3 seconds, so having random checks up to 32 could be one option.There are incoherencies between languages (see comments to issue by anter69 below), but this should be the idea: for this kata, naive recursion should pass while the other requires a different approach.
Here's a lightweight fork that takes around 7 seconds to do the full tests with a recursive implementation: https://www.codewars.com/kumite/62f7baa53afaff002e6960dd?sel=62f7baa53afaff002e6960dd
Approved
Thank you!
D translation
Approved!
Go translation
approved
Rust translation
Approved
Factor translation
Approved
I am now unemployable (for using recursion)
Applying to the wrong bosses then.
LC translation
Approved some time ago by someone
Exact duplicate of this 3 year older kata
That one has performance requirements this one should not have though. ( Haven't checked all translations, but the Haskell original doesn't test past
fib 10
. )funny thing is: the python 7kyu has perf requirements the 6kyu doesn't have...
no
might have been my code (almost certain it wasn't) but recurrence wouldn't work for the python solution. Happy to be proved wrong though.
no need to open a duplicate issue.
Cheers
why are there ""perf"" tests on a 7 kyu kata!?? Java translation goes up to 30 at max, it should be the same in python and any other language
Translates to => plain/basic recursive approach should pass.
improved Java version
long
overflow issue with thatCannot approve, author is active :/
Approved.
Python translation
see issue above, plz.
COBOL translation (author gone).
.
Please approve fork with no 0 input, like in other languages (current version expects 1 for n = 0, which is incorrect).
done
Great kata. Thanks for Java!
As already mentioned, Haskell doesn't have random tests and test cases should also be at least > 30 so that codewars.com/kata/reviews/57a1d5f8969dcdd2290000a7/groups/612a6e5f92c3410001a2212b doesn't pass.
That solution is totally valid in the difficulty level of this kata and the "performance requirements" of the Haskell version match the ones of the other languages. I'll close this issue as there is still the other issue with missing random tests open.
Nasm translation
Approved
Java version is a lot more demanding than other languages. Either its
n
should be reduced, or other languages should have theirn
increased to forbid recursive solutions. Since nothing of perfomance is mentioned in description, the first option should be applied.Java version is also broken since it draws random inputs from
(0, 150)
butfib(93)
already overflowslong
range.I passed java version with recursive approach
Yes, because my version with the adjusted tests was approved 9 minutes before your solve.
oh ok :)
Some language versions do not have random tests, e.g Haskell.
Haskell ( now ) has random tests.
If any other languages don't, please reraise mentioning specific languages.
In C#, the method name should be
Fib
and notfib
, as public method names arePascalCased
in C#.Done!
Java version is broken.
Message prompted in training page is:
Caution: This kata does not currently have any known supported versions for Java. It may not be completable due to dependencies on out-dated libraries/language versions.
Thnx for your comment. I have tried to solve this issue, but did not succeed. Any help appreciated for resolving the issue. JvS
same
Please fix this Kata
Fixed
C-Translation kumited!
https://www.codewars.com/kumite/580b6ca81dc54b1f31000055
Please check and approve it! ;-)
Nice kata! Thanks!