Skip to content

Instantly share code, notes, and snippets.

View matthewcarlisle's full-sized avatar

Matthew Carlisle matthewcarlisle

View GitHub Profile
@matthewcarlisle
matthewcarlisle / flatten.py
Created July 3, 2019 21:58
Flatten arbitrarily nested list of integers in Python
import itertools
import random
import time
'''
Function to flatten an arbitrarily nested array (actually, a list) of ints.
You might be wondering why we wouldn't just use an in-built function to do this.
Well, we could (should?) do that, but sometimes we are gluttons for punishment
and wish to avoid the temptations of Google.