https://medium.com/@dennisyd/understanding-time-and-space-complexity-in-algorithm-development-a375b44b67de