5 kyu

flatten()

2,899 of 4,608jhoffner
Description
Loading description...
Arrays
Algorithms
  • Please sign in or sign up to leave a comment.
  • Quinteroo Avatar

    This comment has been hidden.

  • Savely 818 Avatar

    This comment has been hidden.

  • Quark Fox Avatar

    Thanks jhoffner!!

    Was challenging for me but did alright.

  • momenGamer Avatar

    Thanks Alot, This Is My First Time i Practice Recursion

  • pxladin Avatar

    Why does it say 'Value is not what was expected' with no explanation on the last test? What is expected there?

  • iwtga Avatar

    This comment has been hidden.

  • trentshin Avatar

    very nice kata. It was my first time practicing recursion

  • ejini战神 Avatar

    No sample tests in CS and JS

  • wrong guy Avatar

    I really want to give up to this kata. but think again properly, you can solve this.

  • eternalliving Avatar

    JS version has no test cases and will not do console.log on failed attempt tests... this makes it really hard to figure out what my code is even doing!! Any suggestions on how to force output even on the failed tests?

  • andre-dasilva Avatar

    Nice little kata. that could also be used in a real world application. also really nice recursion exercise

  • webmisfit Avatar

    This comment has been hidden.

  • Melecoco Avatar

    You should add more tests to validate or not the work we do, i once passed your 4 tests but my function wasn't totally good, and it's just because i wanted to refactor and added a sample test i did myself that i saw that my code wasnt totally finished thanks for reading

  • smartspot2 Avatar
  • user8436785 Avatar
  • MattSchupack Avatar

    My code passes all the real tests but fails both samples.

  • Voile Avatar

    The tests is crap at least in JS, it relies on the toString method on user result to compare with expected, so anything that is not primitive (e.g functions and objects) will be destroyed. And Test.expect should be replaced.

    Also, needs random tests.

  • osofem Avatar

    What is that last test all about. Passed all the three first Tests except that last test without any further information.

  • brunolm Avatar

    Aside from no example tests this kata was nice

  • pastrop Avatar

    This comment has been hidden.

  • rockanizw Avatar

    This comment has been hidden.

  • NoPinky Avatar

    This kata is driving me crazy. I don't know what the last test really does, it just says that some value is not as expected. No further information. I even test it in webstorm IDE against several inputs, with null's and empty arrays, nested arrays, everything works fine. I also converted all arguments of the process to an array before flattening. The validation module says:

    Test Passed Test Passed Test Passed Value is not what was expected 3 Passed 1 Failed 0 Errors

    any hints what could be the issue here?

  • pemechas Avatar

    This comment has been hidden.

  • ivanferrer Avatar

    I have not used it, but if someone wants to save that to be happy: /[^,][":]|[,]{2}|[":{[]}]+/gi

  • davidlimcheng Avatar

    This comment has been hidden.

  • harish Avatar

    This is not much helpful test output:

    Test Passed Expected 1,2,3,4,5,6,7,8 but was given

    If you could include the actual result in addition to expected result, would help to debug and fix what's missing.

  • sevvie Avatar

    This comment has been hidden.

  • augustjd Avatar

    This comment has been hidden.

  • jfarmer Avatar

    I can understand writing a function that takes as its input a potentially-nested array and returns a flattened array, but why would we want one that works this way?