6 kyu
Peel the onion
90 of 263Kees de Vreugd
Loading description...
Algorithms
Puzzles
Mathematics
Logic
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.
As mentioned by several commenters below, as of this message, the Java version of this Kata is broken. In order to pass the tests, if you compute any values that exceed the max value for an int, instead just put 2147483647 (the max value for an int) in the applicable index of the array.
Haskell translation
Approved
The output type should be
long[]
in Java.I hope reargem is reading this. I don't know Java.
@reargem
apparently has not been reading this. I commented directly on the translation; I hope he gets notified for that.Nice kata, trains pattern recognition.
nice kata!
This is very cool! Thank you.
Python translation:
https://www.codewars.com/kumite/60fd7ccb4c067d00310c4835?sel=60fd7ccb4c067d00310c4835
Nice! It's approved. The Python solution/ syntax for this one is a piece of art.
There's no point in having 2000 random tests, 100 would be more than enough.
Alright, fixed. Now there's 20 fixed tests (as per ejini战神's request) and 4 * 25 random tests, sorted by size. Closing the issue.
The preloaded stuff should be directly in the tests.
Will do. Just to be sure: who will close this issue after?
Done.
The functions should not be in global scope and should be nested inside
describe
blockit
blocks should be in place withdescribe
blocksThere should also be fixed tests in random test section
JS new test framework should be used
Since when?
They're already present.
It's already used, the only problem is the incorrectly placed
chai
import.What FArekkusu says ... chai import is in the right place now. Except: should there be fixed tests in the random test section? I'd be happy to do it, but I can't imagine why.
Replying to @FArekkusu:
That's just good coding practice to not put everything in global scope ~~ , it's more of a suggestion instead
Replying to @Kees de Vreugd:
Please refer to hobovsky's comment below.
And yes, fixed tests in random test section is a must ~~ as users can compare their fixed tests' result with random tests' one instead of switching from sample and random section multiple times ~~
@ ejini战神: all your and Bobovsky's comments/ issues have been dealt with. Not sure if I agree with the fixed tests in the random test section (still don't see the problem really) but put them there anyway. Thanks, will close this issue now.
The results overflow
Number.MAX_SAFE_INTEGER
.Not sure what happens here. I ran your code and it's failing indeed (only the medium onions). I've put manual limits on s and d. With my solution there are no issues.
Should I change the limits, or force you to reconsider your approach?
This comment has been hidden.
Will check again. Problems are only in the 'medium' onions, right?
@ FArekkusu : you were right. They were not supposed to get that big, so I adjusted all the limits so largest numbers are all safely below Number.MAX_SAFE_INTEGER. Your solution works now. Issue is resolved.
Is this valid for Java translation as well? Observing the same kinda issue...
Yes, I agree with @ParanoidUser. Java is overflowing like crazy in the evaluation tests. My solution passes basic tests just fine.
Apparently, a wrong output-type was used. I don't have the knowledge to fix this: reargem made the Java translation.
Not sure what to do about that ... no arrays over a certain size are displayed with all their elements. Is there a chai method that does?
Please read https://docs.codewars.com/languages/javascript/authoring#chai and the note on
chai.config.truncateThreshold
All arrays are stringified now.