5 kyu

By the Power Set of Castle Grayskull

1,375 of 2,728xcthulhu
Description
Loading description...
Mathematics
Algorithms
  • Please sign in or sign up to leave a comment.
  • ejini战神 Avatar
    • Only 1 random test in CS

    • New framework should be used

  • ahmet_popaj Avatar

    Nice one, well done, many compliments for the kata.

  • trashy_incel Avatar

    OCaml translation (author inactive)

  • mdtagg Avatar

    Im getting an array.sort error when testing

    TypeError: array.sort is not a function at /workspace/node/test.js:37:37 at Array.map () at normalize (test.js:37:18) at doTest (test.js:39:17) at Context. (test.js:47:3) at process.processImmediate (node:internal/timers:471:21)

    Seems like an issue in with the testing suite at first glance but i could be wrong, any ideas?

  • V0id_SakMis Avatar

    I think this kata is broken..it is randomly giving me that "int object is not iterable" at line 5 even though there is no code written on line 5🙃

  • ardb Avatar

    Useless for me, simply because requirements are incomplete.

    The test expects a list with a specific order and the order has nothing to do with (sub)sets. And there is no specific requirement defining precisely any specific order.

  • akar-0 Avatar
  • ejini战神 Avatar

    Description should be language-agnostic

  • hobovsky Avatar

    This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/130.
    Please join the discussion to help us identify duplicate kata and retire them.

  • hobovsky Avatar

    This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/118.
    Please join the discussion to help us identify duplicate kata and retire them.

  • trashy_incel Avatar

    no sample tests in CoffeeScript

  • JohanWiltink Avatar

    ( JS )

    Needs updating to Node 14.x. Needs updating to chai. Needs Example tests. Needs more fixed Submit tests. Needs more random Submit tests. Needs to ask for a Set instead of an Array. ( OK, that last one is debatable. )

  • akar-0 Avatar

    Some libraries are not allowed by Haskell's tests, the description does not say a word about that:

    No using built-ins
    Doesn't use pre-programmed algorithms
    Import declarations must hide Data.List.subsequences, GHC.OldList.subsequences
    

    Moreover other languages with similar built-in libraries (Python and Ruby) don't have such limitations, which make this kata disporportionately difficult in Haskell.

  • FaradayLab Avatar

    Getting this error: ModuleNotFoundError: No module named 'codewars_test'

    Seems the backend needs to be updated, from my understanding?

  • FArekkusu Avatar

    No sample tests.

  • zaxy78 Avatar

    Hi everyone, I've translated this kata to Swift and would love to get it approved :) authors, power users - check it out ;-)

    https://www.codewars.com/kumite/5b70a4721db5ce253b00009c?sel=5b70a4721db5ce253b00009c

    it's been a few weeks since I posted it..

    Thanks !

  • pacmanfn Avatar

    I have some problem with this test-case,("Expected: 8, instead got: 8")

  • tevko Avatar

    This comment has been hidden.

  • jcheroske Avatar

    I'm running into an problem when I submit the kata. I'm passing the first test, but then I'm getting the following error:

    ReferenceError: i is not defined

    I've tested my code in the node cli and it seems to work fine. Is there a way to see the tests that get run on submit?

  • JeremyAtDM Avatar

    This comment has been hidden.

  • karatedog Avatar

    My solution first failed on the random non-numerical test. From the error message it was obvious that if the random characters given in the test are not uniq (there are multiples of some character), then my script fails. So I modified the script (rocket science, applied #uniq! on the method argument) and the test was successful. Then I could look at other people's solution, and I saw tons of solutions that would fail on this test.

  • Madav Avatar

    Hello,

    Why is my solution marked as possible cheat?

  • lisphacker Avatar

    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

  • prymaster Avatar

    This comment has been hidden.

  • GiacomoSorbi Avatar

    Greetings xchtulhu and first of all thanks for this kata :)

    I took the liberty of translating it into Ruby and adding a twist (not numeral randomized lists) to the tests. I hope you will like enough to add it to your work and/or give me some valuable feed to improve my skills :)

  • user578387 Avatar

    Cool kata, neat puzzle!

  • maedox Avatar

    This comment has been hidden.

  • jackmaney Avatar

    Sublists or subsets? Presumably you mean the latter, since that's what the example and title both indicate, but the instructions mention sublists.

    Perhaps specify ordered sublists (to accomodate languages without a readily built-in set data structure)?

  • stephenmac7 Avatar

    I'm getting a so-called "Unknown error." I can't give to code or it will be a "spoiler" though. Note that it works on my local machine.

  • irfan811 Avatar

    please any one tell me how write this problem test case ?

  • Golmote Avatar

    This comment has been hidden.

  • aboellinger Avatar

    Testing code may lack

  • Sebbe Avatar

    Since the problem deals with computing the power set, it'd be natural to expect the result to be given as in the set type, rather than list type.

  • dcorking Avatar

    Does the solution have to accept a nested list/array, or is it sufficient to deal with a flat list/array?

  • wthit56 Avatar

    The description still could use some work. You give an example, but never explicitly say what the function should do, or what a "sublist" means. I've heard it somewhere before, so I had a head-start, but unless explained, it's a pretty hard thing to get your head around.

    Maybe something simple like:

    ...

    Each combination of values should be included in a new array. A combination can be of length 0, up to the number of items in the original array, and any number between.

    So the "power set" of [1,2,3] should include all combinations of length 0 (there is just one: []), and any combinations involving all items of the original length 3 (there is also just one: [1,2,3]). Also, each combination of length 1 ([1], [2], [3]), and 2 ([1,2], [2,3], [1,3]) should be included.

    Note that the order within each combination doesn't matter, and nor does the order of the combinations themselves within the power set.

    So in the example above, the resulting set (array) will look something like this: [[], [1], [2], [3], [1,2], [2,3], [1,3], [1,2,3]].

    ...

    This should make it super-clear what is expected.

  • wthit56 Avatar

    Your first test seems incorrect, unless I've misunderstood (which is quite possible)... It's got [1,2,3] in the expected value set twice. Shouldn't a combination only show up once?

  • wthit56 Avatar

    Sorry if it's a dumb question, but... what on earth am I meant to be doing, here? I know there's some in-joke in the title, probably some sort of mathy thing, but beyond that, there's not much to go on.