Ad
  • Custom User Avatar

    I agree! It's the one that actually does what's asked instead of filtering out everything that's not a number.

  • Custom User Avatar

    I agree mostly, but the instructions do say that the incoming data is lists of non-nengative integers and strings. So the arrays have two types of data. So either way accomplishes the goal. However I do prefer to filter our strings for the reason mentioned that in the future should more data types be added then this function still does it's task without changes. Since the task was to remove strings and not return numbers. The top rated one would require rework to function correctly if other data types were added in the future, so I fail to see why it's "best practice"

  • Custom User Avatar

    I definitely agree, since the instructions say "with the strings filtered out", not "with only the integers returned". The other solutions seem to just be passing the test cases, as opposed to fully following the instructions. Perhaps a random test with different data-types could be added?