Ad
  • Custom User Avatar

    very complicate your solution

  • Custom User Avatar

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

  • Custom User Avatar

    Clever? Absolutely. Best Practices? not really. Better practices than my answer for sure, but I wish every JS answer on code wars wasnt a competition to make the shortest code. Not the author's job to teach others, but ppl shouldnt vote things like that as best practices.

    Semi-related -- the highest voted answer to why they used 'd|0' doesn't answer the question. They did that instead of 'parseInt(d)''. It works for small numbers. Past a certian value, it can start giving the wrong number or sign.

  • Custom User Avatar
  • Custom User Avatar

    sets aren't a good idea either, here... ;p

  • Custom User Avatar

    This is awesome and I need to start using HashSet. My solution was 80 lines of garbage compared to this.

  • Custom User Avatar

    And the random list (at least in javascript, ruby and java) is also ordered. Not a kata issue.

  • Custom User Avatar

    -3, -2, -1, 0, 1 that's -3-1

  • Custom User Avatar

    Ignore the instructions and look at the test cases.
    The test "It should work for random inputs too expected" directly contradicts the instruction "so that it takes a list of integers in increasing order".

    Also the only example is wrong. rangeExtraction({...-3, -2, -1,...}) should be "...-3--1...", but the instruction tells you that it expects "...-3-1..." (the negative sign was left out).

  • Custom User Avatar

    There should be a test (js) where the final string is not over the limit, but the input string is over 140 char limit. Most of these best practices answers test to see if the input string is longer than 140, but the description says that the output string cant be over 140.

  • Custom User Avatar

    if you are going to do it this way, you might as well just return the whole thing. if you say if(*boolean) return true; else return false; its the same as saying return *boolean

  • Custom User Avatar

    Shouldnt a b -(RPN) evaluate to a - b? Because the test cases seem to want it to be b - a