5 kyu
Wood Cut
90 of 195myjinxin2015
Loading description...
Puzzles
Algorithms
Arrays
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.
The description isn't properly worded, and it has the wrong punctuation.
JavaScript basic tests are not working
AFAIK they work fine, click reset and try again.
Env:
Error:
The tests:
I see, in the meantime, you can chose Node v10 or lower until it is fixed.
D translation
approved
random tests should be more complex, they can be solved with a non optimal solution unlike the last two sample tests
Good catch! Indeed. I added random tests that make your naive solution fail systematically (the solution is to choose
n
small enough) to all languages but Haskell (I left a message to the translator so he can revise his translation if he feels like).(author is inactive)
approved Python and Rust, Go was already approved by someone
I need help. I thought there is a bug in test cases, but no one say that.
Woods: [232, 124, 456] For 20 pieces - test case expecting answer 38, but:
232/38 = 6 (after Math.floor) 124/38 = 3 456/38 = 12 total_ 21
You can end with more than n pieces of wood.
Yep.... the problrm with Math.floor()... it doesent work here... i dont know why.... cheked my code in VS Code and it worked, but here it doesen`t work(((((((((
There is no problem with Math.floor, and it works the same everywhere.
Think of it this way; at a length of 38, you ALSO have 20.
COBOL translation (author inactive).
approved
JS: Test cases are a mess full of unused stuff. Needs to be cleaned.
Done + updated to NodeJS 14 and new framework.
Approved
Haskell
A fun little kata.
Happy coding
^_^
Haskell translation
Approved. Thanks ;-)
Reference solution is wrong:
Seems that the reference solution always fails when the correct solution is more than half of the maximum value in the array.
Is it fixed now? ;-)
Looks fixed :)
Fun kata, but reference solution is buggy. Haven't yet figured out where the problem is.
Problem is here
if(Math.floor(n/(sum/max))==0) return max
, but if I take that out the reference solution sometimes gets stuck in a loop, or at least gets so slow the whole kata times out.You can have my solution if you want.
Is it fixed now? ;-)
Issue closed ;-)