https://medium.com/@oluwadaprof/step-by-step-guide-to-solving-complex-algorithms-with-example-in-javascript-792394ca11c0