Ad
  • Custom User Avatar

    Best solution I saw so far in regards to performance! I suspect that most of the speed benefit comparing other solution arrive from the i*i part which is very clever.

    Honestly it's very clear as well, well done! :)

  • Custom User Avatar

    The type for Result is not stated at Go language variant.

    But you can still solve the kata, just code like the following exist (do not add it):
    type Result struct {
    C rune
    L int
    }

  • Custom User Avatar

    Very nice as it's O(n) instead of the naive O(n^2)!

  • Custom User Avatar

    hahahahah awesome!

  • Custom User Avatar

    I agree, the description is really problematic... after too much time I learned that:

    1. You need to convert the input to bits and the result of that conversion is used as the source for the "tape" building
    2. The "tape" is being built by the following commands: [',', '<', '>'] (I wrote it as array for easy understanding)
    3. The '+' command is flipping the value which the pointer point at at the "tape"
    4. The ';' command is adding a 0 or 1 to the binary output build according to the value being pointed by the pointer at the "tape"
    5. '[' and ']' are changing code positions

    I hope this help!

  • Custom User Avatar

    Cheating?

    You are aware that your code is visible to everyone who solved the exercise right? ;)

  • Custom User Avatar
    1. You don't, u r asked to return the maximum height of skyscraper you can check. e.g. when you got only 1 egg and 7 tries if u will throw it from 1000 (for ex. sake) and it will break the test will end at once and you won't have a solution, so your best method is to throw it from level 1, if it doesnt break go to level 2 and so on till you got to level 7 and that's why the solution for that will be 7.

    2. Read above :)

    3. Well answering that will be a spoiler I guess... but rest assured there is a reason.

    By the way I'm still struggling with this problem... I solved the math but the solution is too slow... will be solved eventually :)

  • Custom User Avatar
  • Custom User Avatar

    recursiveCalculation function is not a recursive function since it doesn't call itself to solve the solution but get called multiple times from the outside