Ad
  • Custom User Avatar

    A clarification would still be appreciated. For example, in test case find_all(35, 6), 107999 would be valid even though there is a zero after the one. Zeros that are not the first digit do count in the value of the number.

  • Custom User Avatar

    Thats redundant since 0 would never be greater than it's predecessor digit. And since 0 can not be the first digit, as 0's in front don't modify the actual value of a number, any 0 to the right would never satisfy the incrementing condition.

  • Custom User Avatar

    Today there are better ways to clone an array than via JSON. You can choose from [...arr], arr.slice(), _.clone(arr) for shallow copies, or _.cloneDeep(arr) for deep copies.

  • Custom User Avatar

    There are a few approaches I've seen. You definitely need to call your function first. One method I've seen is to call both functions with JSON.parse(JSON.stringify(s)), this will create a copy of the input for both function calls.

  • Custom User Avatar

    s is mutable (it's an array afterall). That means they clear the array before your tests are ever called.