6 kyu
When greatest is less than smallest
160 of 340NaMe613
Loading description...
Mathematics
Logic
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.
my function passes everything except the huge number suites, where it only gets the first ~17 digits correct. why?
This comment has been hidden.
Int division is key, also seems like you've solved it, closing
Please use new python test framework.
Done
Hey, Im having the same problem here. Upon clicking RunTests, I get "All Ok" in 500 ms, when I Submit, I get "all tests passed" but at the same time "process took more than 8 000 ms". I have no clue where the problem is. Im writing in C#.
What is the criterion for success with this kata? I have code that very clearly works since I can press the Submit button and pass roughly 450 tests. However, at this point the system times out because the process has taken more than 6000ms. Whilst I'm happy to accept that there may be inefficiencies in my code, all the tests seem to be just variations on the same theme and it just seems to be the sheer number that is the issue. How many more tests do I have to pass?
Ruby, I guess? 498 tests, the last ones are the hardest. As always, the first thing to do is to think of a good algorithm. Optimal Ruby solutions here finish in about 75 ms.
Thanks for your reply. It is indeed Ruby. Ah well, back to the drawing board as I look for a better algorithm :-)
Really fun kata but the tests takes too long to run so they time out and I can't submit. Maybe change the tests to smaller numbers?
This comment has been hidden.
If a random Haskell test fails, the user won't know whether
greatest
orsmallest
failed. Split the random tests.Example
Fixed!
Thanks once again for your help
Change the type of
greatest
andsmallest
toInteger -> Integer -> Integer -> Maybe Integer
.Why
Maybe Integer
?Either there exists
Just
one number that fulfils the condition (e.g.greatest 2 3 20 = Just 18
) or none (e.g.greatest 17 19 20 = Nothing
).The type of
smallest
could stay the same though, since that one may always return something.I'm assuming this is also a suggestion to change the expected output when there are no
greatest
from 0 to None/nil/Nothing?If you change the type in Haskell, you have to use
Nothing
andJust
, so that's implied. However, I'm not sure about the other languages. As far as I know,None
,nil
andnull
can be used to indicate that a solution wasn't available, so one might consider it.By the way, the proposed cleaned Haskell tests above don't change the type, since I'm not sure whether you actually want to change the type.
I'm not so sure whether to change it myself : )
So I've left it as is for now, but if others also think it should be changed I will change it.
Thanks for all your help
Yeah, for this kata it's just a matter of taste. That's why it's a suggestion, not an issue ^^.
There is no special casing required to return
0
.0
is notNothing
and it should not be encoded as such.If you look at
0
as divisible byx
andy
(which it is; in both cases the remainder is0
), it makes perfect sense that0
is a legal answer. NoMaybe
required.(Yes, I know I'm late to the party)
Really sweet kata. Quite a challenge to get right without timing out, but I managed :)
A good one! Very challenging due to the high amount of tests. I think in the examples tests, there's one that should be corrected. For me it's 5kyu.
This comment has been hidden.
Thanks for pointing this out,I've updated the tests please check now.
Great! I've marked it as "Ready."
This comment has been hidden.
In the Example Tests section the fifth and sixth test are wrong:
should be
Thanks for pointing this out,I've updated the tests please check now.
I'm not sure if you got my reply, however it seems to be fixed so I'm resolving the issue.
Thanks
Sorry, I forgot to check and reply..
No problem : )