6 kyu

Hollow array

313 of 744aweleshetu
Description
Loading description...
Arrays
Fundamentals
  • Please sign in or sign up to leave a comment.
  • MattE4 Avatar

    The description is not clear enough. The rule "preceded and followed by the same number of non-zero elements" -> does "same" refer to the zeros? Or to the non-zero groups at the beginning and end?

  • ejini战神 Avatar

    All languages should have fixed tests below to invalidate some cheezy solutions that check for summation == 0

    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, -2, -1]

  • ahmet_popaj Avatar

    Had a lot of fun solving this kata, I'd might say relaxing rather than challenging.

  • Puneet1998 Avatar

    This comment has been hidden.

  • trashy_incel Avatar

    C translation

    (author inactive)

  • ELFrancisco4 Avatar

    This comment has been hidden.

  • Danilaq Avatar

    I get this erorr: /workspace/node/test.js:33 Is it okay?

  • luffy_b12 Avatar

    Really confused with the question! [2,0,1,0,0,0,1,0,2] will this return True or False?

  • username0 Avatar

    Suggestion for Typescript,

    have: static isHollow(x) {

    want: static isHollow(array: number[]): boolean {

  • 90sidort Avatar

    Solved this kata but I second to people who says that it is not well described. Wasted time on trying to figure out what are the rules.

  • TheNiv Avatar

    Honestly one of the wrost kata's ive dealt with. Just got stuck with the edges cases for no reason. Question is not clear enough so I just finished the guessing and submitted it.

  • HalfCabCoNi Avatar

    This is either not well explained or the test cases are sloppy.

    here is the definition of what an empty array is, according to the instructions:

    An array is said to be hollow if it contains 3 or more 0s in the middle that are preceded and followed by the same number of non-zero elements.

    considering that, how does this make sense: Expected: true, instead got: false [0, 0, 0] Expected: true, instead got: false [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

    please show me where the "non zero elements" are. Is the absence of anything at all to be considered as "non zero elements"?? seriously??!

    next time i see your name in a Kata Senseï (hopefuly it is easy to recognise), I run the other way.

  • beninato Avatar

    This comment has been hidden.

  • vguzev Avatar

    In the kata description it is stated that zeroes must be preceded and followed by the same number of non-zero elements while in test cases I see Test.assertDeepEquals(isHollow([-1,0,0,0,3]),true);. There is only one non-zero element before and one non-zero element after 0, 0, 0. According to kata description there must be 3 non-zero elements, but not one. Please, clarify the requirements or test cases.

  • HugoHub Avatar

    I found bug in my code and missing edge case - [0,1,0,0,0,1,0] Basically zeroes (symentrical and not) at the ends.

  • HugoHub Avatar

    these are random tests and result (true/false) from my function but I'm still failing tests

    [ 6, 2, 4, 2, 2, 2, 1, 5, 0, -100 ] false [ 0, 1 ] false [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, -2, -1 ] false [ -1, -2, 0, 0, 0, 2, 3 ] true [ 1, 2, 0, 0, 0, 3, 4 ] true [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, -2, -1 ] false [ 2 ] false [ 3, 2, 10, 4, 1, 6, 9 ] false [ 3, 2, 10, 4, 1, 6, 9 ] false [ 1, 3, 9, 8 ] false [ -6, -3, -3, 8, -5, -4 ] false [ 0, 1 ] false [ 3, 2, 10, 4, 1, 6 ] false [ 6, 2, 4, 2, 2, 2, 1, 5, 0, 0, -12, 13, -5, 4, 1 ] false [ 1, 2, 0, 0, 0, 0, 0, 0, 3, 4 ] true [ 0, 1 ] false [ 1, 2, 0, 0, 0, 0, 0, 0, 3, 4 ] true [ 1, 2, 0, 4, 3 ] true

  • ZozoFouchtra Avatar

    This comment has been hidden.

  • myjinxin2015 Avatar
    x=[0,0,0,0,0,0,0,0,0,0]
    Test Passed: Value deep equals true
    

    Why?

  • ZED.CWT Avatar

    This comment has been hidden.

  • Voile Avatar

    https://www.codewars.com/kata/reviews/59b729d5677bf16e7b00003e/groups/59b73725677bf148240000d2

    I managed to submit a bugged solution again.

    Again, I'll leave it to you to find out why it's bugged ;-)