Ad
  • Custom User Avatar

    If you are doing it like i think you are, with big numbers, raising them to a power and multiplying them is not O(1), because they are no longer stored in a 32 or 64 bit integer.

  • Custom User Avatar

    I don't know if this kata has been done before but i have one.
    It's making a function that calculates the result of a ↑(n) b,
    the hyper-operation of order n between a and b.

    a ↑(1) b = a + b
    a ↑(2) b = a * b
    a ↑(3) b = a ^ b
    and so on...

    taking into account that
    a * b = a + a + ...(b times) + a, and
    a ^ b = a * a * ...(b times) * a