8 kyu
The falling speed of petals
4,027 of 17,158Uxie
Loading description...
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.
//"sakura".length = ???
//speed more 0 ??
// my answer is two string...
this kata need more information about code and requirements
That's too vague, please detail what are you suggesting.
Yeeeeeeeeeey!! This was the last level 8 problem in C++.
P.S. I'll leave a comment as a reminder. ;)
congratulation at 3kyu
Dividing the speed by 5 should be a valid answer too (instead of multiplying the distance by 5). The tests shouldn't rely on a rounded value to 15 decimal spots.
Damn, the story makes my stomach pain.
That's really upset.
This kata is so bad, it has nothing to do with anything.
what is the inf ?
This comment has been hidden.
This comment has been hidden.
Ruby 3.0 should be enabled, read this to learn how to do it
Please organize the structure of test fixture as following (although it has been mentioned in the attached link, I'm repeated here again)
fixed
Expected: 14.814814814814815, instead got: 14.814814814814813 !!!!!!!!!!
what language?
I started to learn JavaScript 5 weeks ago and I try to understand step by step. I should create a constant with a fix value (400), but I want to use "ratio", so I used " / " sign in two variablem. If I use only one " / " with the speed, there is no problem with the decimals.
simpuh
really you are comparing floats with equality? thats a fail :)
400/Infinity = Infinity? How come? Other sourses compute it as 0, but codewars give Infinity? Wtf?
This comment has been hidden.
Hmmm...rounding to 15 decimal spots??? Really???
I was going to have a nice simple solution for this... then it wanted me to give the answer to 13(?) decimal places 😬
The average distance is 400cm! It should be given in the description.
round the tests. 14 / 15 decimal places feels ridiculous.
JavaScript
Tested and passed while it using the "tests" then failed when doing "attempt" with error:
Expected: 32.52032520325203, instead got: 33.333333333333336
This comment has been hidden.
C++ tested and passed while it using the "tests" then failed when doing "attempt". also more test cases will help see what exactly you are looking for.
This comment has been hidden.
Julia translation :)
MINOR ISSUE JUST NITPICKING OK?? it says it the desc, "quite compilcated", it should be "quite complicated"
sry
Fixed.
I'm using C# but it keeps saying that it ecpects me to return 80 so I change it and then it says that it expects 40, 0, 2, and a few other numbers. Can you please fix it?
This comment has been hidden.
Not an issue. Your solution is wrong.
PHP translation is ready! Please check and approve it.
TypeScript translation is ready! Please check and approve it.
There is an error in the TypeScript Translation intial code is export const sakuraFall(v: number): number { // your code here }
should be export function sakuraFall(v: number): number { // your code here }
Yes. I agree with you, but when you translate some katas you shouldn't change autors idea. In JS he use this way of initialisation.
This is JS inital code:
I don't see a problem with using const, but right now it's got errors in it ( missing
=
and=>
). It should be something like:@KiparD
: please fork and fix it, and post the link to it here.Yes you are right. I changed it here
That's odd, it won't let me approve it, and doesn't provide an error message either. Maybe another PU can give it a go... I don't think the author is coming back to approve it :D
Fixed.
C++, failed test:
RandomTest Expected: equal to 2.95824 Actual: 2.95824
already raised below, closing
how did you solve it? i din't understand the comment above/
can we dislike this kata? worst kata of all time
You are in for a shock. There are far far worse out there.
most of the languages assert float as exact values, leading to troubles.
I corrected ruby (which was missing the fixed tests too...) and python. Still to update:
C++, C#, JS.
c# still is not able to be completed because of rounding
c# still have the rounding issues
Are you sure that this is a 8 kyu kata?
This comment has been hidden.
Did you try without
floor
'ing?I tried it without, i tride it with ceil and i tried it with round, not sure why none of it worked...
I removed
floor
and it worked -_-I have no idea why it doesn't work for you.
Oh man the feels @.@
5 cm/ second <3 (also name of a beautiful animé movie) Just wanted to share that ^_ ^
the tested value should definately be rounded to 2 decimals or simply made in int. i've attempted it 5 times now, getting 18 errors, 17 errors, 14 errors 13 errors 19 errors
all because of rounding errors.
Change the kata description. It's unbearable to see how you have to re-read it, and look at the sample tests' arguments and expected results just to grasp the idea that the
S
, which you need to plug into thet = S/V
formula, equals to400
.Javascript translation created
I see there's a Javascript version of this kata, so this suggestion is resolved.
10.526315789473683 should equal 10.526315789473685
you kidding me???
This comment has been hidden.
The tested value should probably be rounded (e.g., to 2 places). In Ruby, I had a couple of failing tests because I had a difference on the last decimal...
Rounding is not the correct way to handle floating point errors.
Comparing with a threshold is the correct one.
Hmm. Care to elaborate?
Floating point errors at rounding boundaries is still not eliminated, so you're just pushing all the problems to there.
Makes sense, thank you! :)
reported above with update, closing here.
Sad to see no one here mentioned the reference to the anime movie "Five cintimeters per second"
One of my all time favorites.
The kata is based on the anime and you can get it in the description and tests(XD
I only didn't because I've never heard of it, lol. Had I, I would've definitely mentioned it! :)
Typo: "compilcated"
I don't know if it was just me, but I found the instructions very difficult to follow. I think it could be re-written to be a little more straightforward. The task itself was extremely simple, but I had to re-read the instructions many times just to understand what was being asked.
Description updated.
Sorry but I'm not so good at discribing something...
This comment has been hidden.
Fixed.
In python the function name should use snake_case. After renaming the function in all occurances, you should add the following code to the test suite to keep old solutions valid:
Implemented, along with python 2 compatibility.
Ruby translation kumited!
I see it was approved, thanks!
I have made a C# translation for this.
Thank you www
not enough random tests: put it in a loop of 50 repetitions
Numbers of random tests have been changed to 50. Thank you!
This comment has been hidden.
Sorry, but I don't know what you want to express exactly. Are sample tests so many that give them too many hints?
This comment has been hidden.
The sample tests have just been adjusted. Thank you!
;-)
What is the purpose of making a class with just one static method? And it at feels like a duplicate (even if isn't exactly) of any 8 kyu kata requiring 1 simple expression.
You're right. It;s not necessary to make a class at all. So I use a function instead. And……Maybe it's a duplicate but I just want to try making a kata:) Thank you!