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.
Python translation
tag this kata as
Strings
The specialty of this kata is not a real search for duplicates or uniques, but the use of the property that in the list there are only numbers 1 to some n, without holes, sequentially (not random from any numbers).
On this basis, you can make some assumptions, evaluate some properties of the list, without building a set() or a list of " seen duplicates" etc.
PS. oh, I saw that this is a complaint about the tests passing suboptimal algorithms, so they work very quickly, even set(inList). not just asking for a hint
lets convert
02|15|59, 2|47|16, 02|17|20, 2|32|34, 2|32|34, 2|17|17
to seconds. and sorted timings are:8159, 8237, 8240, 9154, 9154, 10036
loooks like your algorithm decided to take 8240 as value for median, but here is not even number of items. so median is - average between 8240 an 9154 (check median definition from kata details)
Python translation
I totally understand. It was a joke.
This comment is hidden because it contains spoiler information about the solution
import pandas as pd
Q: Why are you importing pandas?
A: The task requires analysis, and what kind of analyst am I without a pandas?
That was the goal, yes :)
reminded me of a story, "Laboratory Chronicles". where there was something like:
in the documentation we have pressure in megapascals, but how could they know that the graduation on our pressure gauge was in pounds per square inch.
you're supposed to call the methods on an instance, not on the class
(the design of the task is completely bloated, actually, these should have been static or better, class methods. But definitely not instance methods)
TypeError: method() takes exactly 1 positional argument (2 given)
Explicitness is good for whoever is reading your code, but you've got to know how much explicitness is too much.
This comment is hidden because it contains spoiler information about the solution
Super clean and readable!
This comment is hidden because it contains spoiler information about the solution
Loading more items...