Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • 14909989?v=3

    Not an issue

  • Profile pic

    Then how is [1,3] a subsequence of [1,2,3] as stated in the example?

  • 34634ff10f1f6c606b4d59448e0bad10?d=https%3a%2f%2fidenticons.github.com%2f04463fa450a9660205e510d5fff98597

    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

  • 234491?v=2

    Cheers, I thought I'd tried that too, but there was a bug in the code. It's working now.

  • 6301773?v=2

    It isn't a set, but a sequence/list. The title "power set" is a little bit misleading. You need to return the set of all subsequences, not the set of all subsets, e.g.

    --      2nd zero        2nd zero
    --       v               v
    power [0,0] = [[], [0], [0], [0,0]]
    --     ^            ^
    --     1st zero    1st zero
    
  • 234491?v=2

    Hi

    I've implemented a solution for this problem in Haskell, but when I submit it, it fails for tests with the input consisting of lists of zeros, eg, [0,0,0,0] or [0,0,0,0,0,0,0,0]. What is the expected solution for this? If this was a set, then this would be an invalid input since there can't be duplicates, correct? I'm removing any duplicates, which results in the set [0], which should have the power set [[], [0]], but this is not being accepted. Any suggestions?

    Cheers
    Gautham

  • 6301773?v=2

    This has been reported several times, but the author isn't active anymore. See the issues by @muesli4, @karoyakani, @knotman90, @Thom and @pcapriotti.

  • 234491?v=2

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

  • 234491?v=2

    I have a solution that works fine under ghci and gives the correct answer without any visible delay. However, when I paste it into the Codewars editor and run the test (the same data tested under ghci on my laptop), it says the the submission timed out. I don't think it's a performance issue since it works quite fast on a dual-core laptop (I'm not using any parallel libs, in fact nothing other thatn Prelude). Any suggestions?