Ad
  • Custom User Avatar

    Added in this fork

  • Custom User Avatar

    Added in this fork

  • Custom User Avatar

    No random tests.

  • Custom User Avatar

    No sample tests.

  • Custom User Avatar
  • Custom User Avatar

    @Wei-LiangChew I'm a little late but then the while loop will iterate over with n - 1 = 8 (and so on)

  • Custom User Avatar

    But what if the largest 5-digit number in digits doesn't start with 9?

  • Custom User Avatar

    Hey Ricardo! Yeah I thought it was you. I just started codewars :) Thanks man. Hope you're doing good as well!

  • Custom User Avatar

    Hey Freddy, what's up bro? This is Ricardo, from Ayu!

    Hope you're well

    I just got it, thanks!

  • Custom User Avatar

    I think it means that if a 'Bag' object does not have any elements in it, then it should not blow up the tests. So your code should still work even for 'Bag' objects that happen to not have anything in it.

  • Custom User Avatar

    I don't know what it means with "Empty bags should pass all tests.", anybody?

    I also can't see the output for any kata.

    Thanks!

  • Custom User Avatar

    Nice one-liner. The Array allocated by split('') or chars gives this algorithm O(n) space complexity, it's possible to solve this with O(1) space complexity. All voted on solutions share this problem.

  • Custom User Avatar

    Great Job, I just started to learn regex, and I find it really useful ( rather than iterate over each caracter and check), it could be a little faster if you replace .sort.pop for .max, I'm still not sure how regex does it, because in order to find all chunks starting with 9 and 4 more digits it still needs to iterate over all the array, so Im not sure why my solution is slower, maybe because the regex is executed in a binary library rather than interpreted like ruby ?

  • Custom User Avatar

    I really appreciated the sense of humor in this kata! It made it a lot of fun. But it would probably be a good idea to rename the #each test, because

    #each:
    should execute the block for each item in the bag. why are you messing with this method? work on #every? instead.

    is very confusing, and seems to imply that we cannot use the #each method in the kata. So this kata could use some revision for clarity. Other than that I liked it though.

  • Custom User Avatar

    Given that each and count have already been implemented, you shouldn't need to fully define the Bag class or its initialize method. These should already exist. Your implementation should focus strictly on every? and any further helper methods you need to create for that to work.

  • Loading more items...