Skip to content

Instantly share code, notes, and snippets.

@alexandv
alexandv / flatten_list.py
Last active December 13, 2018 17:40
Flatten an array of arbitrarily nested arrays of integers into a flat array of integers.
# Requires python >=3.5
from typing import List
def flatten_list(nested_list: List) -> List[int]:
"""
Flatten a list of arbitrarily nested lists of integers.
:param nested_list: The list to flatten. Can contain nested lists of integers or integers.
:type nested_list: list
:return: Returns the flatten list of integers.

Keybase proof

I hereby claim:

  • I am alexandv on github.
  • I am alexvin (https://keybase.io/alexvin) on keybase.
  • I have a public key ASDz8JRSAWB9BNBE-V5j6jOPqqlRtduB7muviW9btoaOeAo

To claim this, I am signing this object: