Ad
  • Default User Avatar

    When I run removeZeros([1,null,"5","2",8,6,null,false,"0",0]) in my IDE it returns [1, null, '5', '2', 8, 6, null, false, '0', 0].
    When I run removeZeros([1,null,"5","2",8,6,null,false,"0",0]) on Codewars it returns [1, null, '5', '2', 8, 6, null, false, 0, '0'].

    Eh?! Help pls :D

  • Default User Avatar

    Okay :/

  • Default User Avatar

    Yeah... was my bad. All good :)

  • Default User Avatar
      .W.
      .W.
      ...
      .W.
      .W.
      W..
    

    expected:<false> but was:<true>

    But you can reach the goal or do I missunderstand smth here?

  • Default User Avatar

    Ah okay. Thanks for the explanation. Seems like I need to refactor my solution :D

  • Default User Avatar

    Yeah, looks like an issue that needs to be fixed. But the result of solution([-83, 33, -32, 83, -56, -43, 76, 65, -100, 47, 48, 49, 50, 51, 52, -22, -98, 22, 8, -17, -38, -37, -36, -35, -34, -33, -62, 74, 75, 76, 77, 78, 79, 6, 7, 8, 9, 10, 11, 12, 51, 52, -52, -51, -50, -49, -48, -47, -46, -57, 82, 86, 87, 88, 89, 90, 91, -34, -33, -32, -31, -30, -10, -92, 32]) is correct if you have written a working algorithm ;)

  • Default User Avatar

    Ups. Second example is wrong anyways. I was talking about ["NORTH", "WEST", "SOUTH", "EAST"]. But I think I understand now.

  • Default User Avatar

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

  • Default User Avatar

    I might be wrong, but I think this solution is not entirely correct.

    sum_pairs([3, 5, 3, 5, 3, 7], 10) should return [3, 7].

    However, this algorithm would return [5, 5].

  • Default User Avatar

    Oh! Didn't see xD

  • Default User Avatar

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

  • Default User Avatar

    This comment got deleted.

  • Default User Avatar

    Ah. Good to hear :)

  • Default User Avatar

    Well... even though my code didn't quite get through the attempt, i'm pretty happy with my one liner.

    My code does exactly what is written in the requirements (combine the digits of each list and add the resulting numbers together, e.g. [0, 9], [] --> 9 + 0 --> [9]). Therefore the input results for the following inputs should equal:

    [0], [0] --> [0] (I mean... even the input test for [0], [] should equal [0]. Why shouldn't this be the case when both lists contain zeros)
    [3, 0, 0], [] --> [3, 0, 0]
    [0, 5], [] --> [5]

    And so on...

    Please change :|

  • Default User Avatar

    A button to delete your own solutions would be helpful. Especially if you accidentally upload another user's solution a second time.

  • Loading more items...