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.
Not all kata are designed for interview.
If you expect all solutions to be prod-ready, you are not on the right website.
Here is a suggestion to learn from this solution: you should ask for explanations politely.
It may bring you more insights than complaining.
If you are still timing out, you are using an inefficient algorithm. Some solutions solve this problem within a second.
ОК, thanks. To paste the solution (text of program) - was my mistake. I decided this task, the other comment helped me.
First of all. Do not paste solutions on discussion. If you cannot find the solution yourself unblock solutions. You don't deserve expertise so you can give it up.
There is faster solution for that, which I was not aware until I unlocked solutions.
Your solution is O(n log_K n)
This comment is hidden because it contains spoiler information about the solution
what kind of book should I read to think of good solution by myself?
I like it that "best practices" here on CodeWars are the solutions that are not for winning the interview.
Is this readable? No. Can I learn from it? If focused.
it is. But inbuilt iterators are faster than your own loops. Python generators and iterators are written inside interpreter and are much more efficient.
I tested it out.
This Version for long text: 0.0077
Version with my custom loop: 0.0256
I tested it out. Version without set() is much much slower than any other solution pasted here.
This should not be best practices.
Time of execution for long text of this version: 0.27908778190612793
time of exection for long text where you iterate over set: 0.0005300045013427734
I personally use CodeWars to practice my thinking, not "using libraries which does my job". While in office I would search for solution in external libraries but it does not have any point in here
agree to disagree. As I see your point of view valid I also think of it like this: Ok, I know how to permuate a list with itertools, but it's crucial for me to know what exaclty permutation is and how the alghoritm look like
This is why I thought that itertools is considered cheating :<
I thought that writing your own product func is the goal :)
Good point...
it looks nice, one liner.
I personnaly prefer manually iterating each letter to reduce complexity
Loading more items...