Cracking-the-Coding-Interview-TypeScript
Cracking-the-Coding-Interview-TypeScript copied to clipboard
Cracking the Coding Interview 6th Ed. TypeScript Solutions
These exercises were completed using the (now deprecated) AdjacencyList util https://github.com/Braden1996/Cracking-the-Coding-Interview-TypeScript/blob/78aa4efe6f2126c95d41fccc574fbb93fad92e7f/src/utils/AdjacencyList.ts#L6 They should be refactored to use the new Graph util: https://github.com/Braden1996/Cracking-the-Coding-Interview-TypeScript/blob/78aa4efe6f2126c95d41fccc574fbb93fad92e7f/src/utils/Graph/index.ts#L6
Calculate length of longest branch and check that it is less than `Math.floor(totalNumberOfNodes)`.
Would be nice to write unit-tests validating that these data-structures (and they're given methods) work as expected.
Currently, there are no checks in place to verify that the Node is actually part of a tree. This means, this function may recurse forever (until crash).