cracking-the-coding-interview icon indicating copy to clipboard operation
cracking-the-coding-interview copied to clipboard

Solutions for the book: Cracking the coding interview V4. Written in C++.

Results 7 cracking-the-coding-interview issues
Sort by recently updated
recently updated
newest added

In stack operations don't we have to include header file for program to recognize push(), pop() operations? Also my program was complaining when I delcared s1, s2 in private. I...

如果 m == 9, 那么 循环链表 就在最后一个 node 中循环, debug 时 看着效果不明显.

我在面试的时候遇到这题两次,也算是高频,所以想在这里提一点可以改进的意见:) 这里假设节点里包含指向父节点的指针parent。 面试的时候,面试官一步步加大难度,最后让我写时间O(n)空间O(1)的方案。我在他的提示下,得到了如下方案,请您过目。 后来面试完我才发现,原来leetcode里已经讲过这个方案了,[这是链接](http://leetcode.com/2011/07/lowest-common-ancestor-of-a-binary-tree-part-ii.html)。 ``` int getHeight(Node *node) { int height = 0; while (node) { height++; node = node->parent; } return height; } Node* first_ancestor(Node* n1, Node* n2){ int...