Ad
  • Custom User Avatar

    Thank you for the commitment.

  • Custom User Avatar

    I think 5+5 tests are enough. The main idea of the cata is not to allow writing simple solution. And it needs to randomize test cases to prevent predicting test valus. You know, lots of katas can be solved like:

    def fibonacci(n)
      return 3 if n == 5
      return 13 if n == 8
      return 4181 if n == 20
    end
    

    And it's not good

  • Custom User Avatar

    i think it's enough:)

  • Custom User Avatar

    I've just changed the description of the kata. What do you think, it's better?

  • Custom User Avatar

    Kata was moved from Beta status to public, so at least it means the kata is correct. I did not want to write easy kata that could be solved by using easy alghoritm or just monkey code. It's a bit hard kata and hidden tests are using extremely big numbers so you solution must be very efficient. The numbers in tests are randomized and you cab see them if you add "puts number" in your solution. For example, there can be number like 35184372088832, so you solution shoul be enough efficient.

    What is about your first point: i even don't know what could be wrong with description if there are even examples of usage:
    power_of_two?(4096) # true
    power_of_two?(333) # false

  • Custom User Avatar

    You are resourceful:) Thank you for the note, but unfortunately Test Cases are locked and i can not edit them anymore:( It probably happened when the kata was moved from Beta to "Production".

  • Custom User Avatar

    '2' is a power of '2' where the exponent is '1'

  • Custom User Avatar

    There are a few ways to get know if a number is power of two. And all of them will work quickly with small numbers. But the hidden test cases(which you run by pressing 'submit' buttom) use very big numbers. And some alghoritms will be able to deal with very big numbers for a short time. Yes, it's a kind of joke why i didn't show all values in public test cases:)

  • Custom User Avatar

    The timeout happens because of test cases use very big numbers, and not all solutions can be good.

  • Custom User Avatar

    Sorry for the long time response, i was away.
    I know that my english is not good.
    Could you please write correct english description? I will be happy to write better description.

  • Custom User Avatar

    Maybe. It's interesting: if i change testcases and republish this kata, will it remove progress and existing solutions?