• Custom User Avatar

    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)

  • Custom User Avatar

    what kind of book should I read to think of good solution by myself?

  • Custom User Avatar

    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.

  • Custom User Avatar

    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

  • Custom User Avatar

    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

  • Custom User Avatar

    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

  • Custom User Avatar

    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

  • Custom User Avatar

    This is why I thought that itertools is considered cheating :<

  • Custom User Avatar

    I thought that writing your own product func is the goal :)

  • Custom User Avatar

    it looks nice, one liner.

    I personnaly prefer manually iterating each letter to reduce complexity

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    this is my first solution. but i feel it is O(5n) and with simple for .. you can do it just O(n)

  • Custom User Avatar

    why most "best practices" is for solution that do two sums in every round?