Nov-24-2018, 11:54 PM
This is probably fine, but ichabod's solution is quadratic time where you probably intend linear time. Here's part of the second solution I was referring to:
def flatten(nested_list, result=None): if result is None: result = []The rest of the body should be the same as your original solution. This supports the same interface as your original solution, except that (as I lamented) someone could pass in the additional parameter.