Ad
  • Custom User Avatar

    You would be surprised how many people failed to come up with the solution. The fact something is basic for you doesn't mean it's basic for everyone.

  • Custom User Avatar

    Have you actually tried printing what that solution returns? Why do you assume the test is broken? there are over 700 passed solutions to this. Wouldn't it make more sense to assume it's your solution that is broken?

    Try building a tree provided as an example, and see if your solution prints the expected output.

    Hint: the result of a function in ruby is the last expression in it. in your case, it's

    sort_tree(node.right, acc)
    

    Do you think that call will return the expected call?

  • Custom User Avatar

    Please pay attention to memory complexity! I wish Codewars had some way for testing that as well.

  • Custom User Avatar

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

  • Custom User Avatar

    Hi Lilian,

    big tree is [1] * 100000 . you are checking if list.length > 10000, so you are stopping the execution before it finishes processing the array.

    Few hints about how to improve performance:
    concating arrays using '+' is almost never efficient enough. Try using other methods
    Is children array really needed?

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

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

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Custom User Avatar

    Hi, I'm the original author of this Kata (Ruby version). Author of the haskell version didn't understand this Kata properly, and indeed added a DFS version instead of BFS.

    I have learned haskell to fix this. I added a BFS solution and a correct buildTree (thanks to @nickie for providing one). Please take a look again.

    Thanks,
    Karol

  • Loading more items...