4 kyu

Hypercube Lists

Description
Loading description...
Algorithms
Lists
Recursion
  • Please sign in or sign up to leave a comment.
  • dfhwze Avatar

    It should be clearly stated in the description the input should not be modified. From the current description, several users interpreted that an inline modification of the list was required, or at least possible.

  • koba1996 Avatar

    Really cool kata, it should be much more popular. The description seems scary, but the task itself is not that hard. Give it a try!

  • WinterShiver Avatar

    Do not modify the nested list in your implementation or you won't pass the test ;)

  • valentine909 Avatar

    It took me some time to understand that given nested list should not be modified in the process. I think a clear mentioning of such requirement should be provided in the task section.

  • caralis Avatar

    i don´t really know how to start please help

  • yes151127 Avatar

    I don't understand this error message input should not be changed: [[5, 2, [0, 0, 0, 0], [0, 0, 0, 0]], 1] should equal [[5, 2, [], []], 1] Does this message mean that [[5, 2, [], []], 1] should be a hypercube? it's strange...

    My code passes all tests except "input should not be changed" tests.

  • ALowVerus Avatar

    Test case with given array [[], [], [], []] returns the following error:

    [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]] should equal [[3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3], [3, 3, 3, 3]]
    

    Am I misunderstanding this? The pattern looks like "If you see a lone number available in a slot, duplicate it appropriately, but if there is nothing there, add 0s", yet somehow your algo wants 3s here.

  • G_kuldeep Avatar

    approved.

  • Blind4Basics Avatar

    Your kata is really interesting, but presents A LOT of problems, for now...:

    Description / solution setup:

    • the optionnal parameter is incorrectly described/named: at first I understood it as something to add to the actual dimension of the nested lists while it's actually only a default value. So name it that way: default (well, it's said in the description, yes, but since there are no sample tests with that, the information is only shown "with 5 words" in the whole (huge) descirption)
    • not sure the hints are useful. Maybe just keep the one about recursion?
    • some typo in there (aN function somewhere near the end, for example)
    • just after the first code block, you have two definitions on the same line (lacking some formatting)
    • no need to put "nested list" in bold everywhere, especially when that's actually not what's important in the sentence ;) (see the definitions of size and dimension!)
    • you should put a short description of the task before you explain what a hypercube list is (not explainning all the details of the parameters at this moment, but just that You'll have to transform an input nested list into an hypercube list, which is a special kind of nested list where each level must have the very same size, the nesting going to the same depth in each branch too (You'll surely need to reformulate the last part about the depth: I cannot find a way to translate correctly what I have in mind in english). And only then give the example and the formal definitions if you want.

    Sample tests: you HAVE to put in there:

    • ALL the examples of the description (especially the most complex/first one!)
    • calls with the second parameter
    • tests with the dimension defined by a sublist (currently, it's always the first level that imposed the dimension)
    • same as above but feeding the function with a default value

    Test cases:

    • your random generator seems to be somewhat "unbounded". That means it sometimes generate very HUGE nested lists and/or that your generator sometimes fails to break out from a while loop or a recursion. And that means the test suite can sometimes badly time out for no apparent reason from the user's point of view.

    If you resolve all of these problems, your kata will become a really solid one. You put a lot of effort in the test suite, already, it's a good one. Just make it perfect! ;)

  • tmxk Avatar

    (using python)

    Is it an issue or did I do something wrong if I get

    Traceback (most recent call last):
      File "main.py", line 1, in <module>
        from solution import *
      File "/home/codewarrior/solution.py", line 1, in <module>
        from setup import *
      File "/home/codewarrior/setup.py", line 2, in <module>
        from typing import *
    ImportError: No module named 'typing'
    

    even when I just submit

    def normalize(*a,**b):
        1/0
    
  • ZED.CWT Avatar

    This comment has been hidden.