Ad
  • Custom User Avatar

    One floor:

     /\
     —
    /\/\
    

    Four floors:

        /\
        —
       /\/\
       — —
      /\/\/\
      — — —
     /\/\/\/\
     — — — —
    /\/\/\/\/\
    
  • Default User Avatar

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

  • Custom User Avatar

    Practially, it doesn't make any difference. The init method automatically returns none, so you don't need to include that instruction in your code. The 'pass' keyword does nothing, it is basically just a placeholder to keep Python from getting angry that you didn't include an indented block in the init method. If you used an empty return, or return None, you'd get the same results, you're just doing a little more work than you need to.

  • Custom User Avatar

    @moonrhino68, I think that on the pc on which you can use the shortcuts has No Editting Mode Enabled(VIM or ENAC), while on the other pc anyone of them is enabled.

  • Default User Avatar

    I don't think the test suite is complete. The problem description says it should be sorted by most frequent letter and then alphabetically for letters with the same frequency. I used tupList = sorted(tupList, key = lambda tup: tup[1], reverse=True) as my sort which doesn't account for sorting alphabetically in the event of matching frequencies, but I passed the kata.

  • Default User Avatar

    Did anyone figure out a solution better than O(n^2)? Is it possible?

  • Default User Avatar

    I passed the test suite and went back to clear out print statements / add comments. Now it times out and says unknown error whenever I submit. The submit button has turned dark and I can't press it anymore. Possibly a code wars server issue? Edit: It shows taht I passed in my completed kata section. Code wars just won't allow me to submit again and says to check my internet connection (i did, it works).

  • Default User Avatar

    No, I think it's the same... if you don't need pi outside the function.

  • Default User Avatar

    Does importing pi within the function provide an advantage over importing it at the top?

  • Custom User Avatar

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

  • Default User Avatar

    My first attempt was to try and return l.reverse(). I kept getting "None" as a result. Can someone explain why you have to do l.reverse() then return l instead of return l.reverse()?

  • Default User Avatar

    It seems like everyone is doing the same thing with pass. I didn't pass or return and it worked. Is pass safer or better practice? How does it compare to an empty return?

  • Default User Avatar

    It's unlikely a powerful machine will pass the test with a slow algorithm. If you're using an O(N^2) algorithm and the input size is 10 million, 10 million squared is 10 trillion. The naive implementation here will run in N^2 / 2 which is 5 trillion. Even if you can run through 1 billion base operations per second it will take minutes to complete.

  • Default User Avatar

    I've had this happen on the server sometimes. I try to test it with something super simple like a console.log() or 1+2. If it still happens I just go take a break. It fixes itself on their end.

  • Default User Avatar

    similar to what floydchen said, the ENTIRE PAIR 3 and 7 comes before the second value of 5,5 so it's counted as earlier

  • Loading more items...