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.
Even if intermediate imprecision is avoidable, the kata may invite such imprecision, or it may be too much to ask of solvers to avoid it without a specific mention in the description.
Note that your solution uses
/
andMath.ceil
, which means the answer might now be off by one instead of off by a very small number, and the tests do not make any allowances for that.Floating point operations are inherently imprecise, and the only way to deal with that is using approximate comparisons; any rounding has the possibility of introducing errors.
But I'm still not reopening a 6 year old
Issue
.I was referring to using only intermediate rationals, yes. Looking back at my solution, in fact, I seem to have used only intermediate integers.
Working in python, it seems that the test has integers inside nested lists.
''' The content of a dictionary item is not correct: [42740748] should equal [[42740748]] '''
This is also causing a TypeError, can't compare 'list' to 'int'
Looking at the rules and examples, the result should be a list of ints, not a list of a list of ints.
Approved
python new test framework is required. updated in this fork
Type error in description
I think you are wrong ( unless you use intermediate rationals instead of floating point numbers. but JS has no native rationals ).
But I am not reopening a six year old issue.
Issue resolved at some point in the past; tests now compare only integers and an integer solution can be calculated with no floating-point intermediates.
55 kg, 10% scrap ==> 5.5 kg scrap ==> 49.5 kg ==> no robot
This was my answer except I got an error for not having the ? after n, and I couldn't figure out how to fix it. Thank you!
nice solution, I just dislike how you've written the IsPrime function. The if that everything is wrapped in could easily be replaced with another guard clause. You did use guards so you seem to know that guards are prefered when using ifs.
how about if input is 2 return true, if input is 1 return false? so that catches the only edge cases I have in mind right now with a nice guard clause and then you can keep your approach without nesting everything into an if check.
Why is the second argument when calling iterate the function with the tail value? Why not just Iterate(f, x), since that's the parameter order. Idk this one confuses me.
It's probably been a long time since you did this kata. I'm trying to understand your recursion but i keep getting lost in the way. Would it be too much to ask for your help?
I had to at least try asking.
Beautiful!
it's the range operator, he's taking the quotes elements starting from i till the end of the array
Loading more items...