- Run
npm i
(requires lodash + axios) - Run
npm run traverse
(see npm scripts) - Profit. :)
- It will take O(n) because we need to visit every node and add it to our list of visited nodes
- The fetch time O(1)
- The calucate and sumation will take O(1) because we need to reduce every node into 1 node.
- O(n) + O(1) + O(n) => O(n)