5 kyu
Simple Fun #383: Counting Sheep II
31 of 32myjinxin2015
Loading description...
Algorithms
Performance
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.
Python:
I wonder if out wouldn't be better to actually time the ref and the user's function alone (without counting the input generation), then decide to invalidate based on the time comparison. I got a first solution that was barely passing, and before that, one that timed out at 97 random tests.
(note: the ref is a bit slow)
should I take your solution as ref sol?
if you go with time measurements, you can reduce the runtime to 2s each and pick anyone you want: it's then just about picking a different factor.
The critical thing is to decide what should or shouldn't pass.
probably the slowest of the 3 current solutions as benchmark
typically:
Solutions can be approx. 20% slower as my solution. Both your solutions above are too slow now.
:+1:
JS testscases are full of unused material, it needs to be cleaned.
fixed
python translation
approved after some changes
Is this a joke or is this kata about heavy micro optimisation?
well, not so heavy. my quite a stupid solution barely passed, but it passed.
ref. one is way faster
How ironic, all attempts I considered smart failed miserably.
The difference between passing and failing is using
var
instead oflet
andconst
.That is, in my opinion, pushing the performance requirement too far.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Problem seems to have been solved by ( automatic ) Node upgrade.