Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDepthRec #1

Open
mousepotato opened this issue Oct 9, 2014 · 6 comments
Open

getDepthRec #1

mousepotato opened this issue Oct 9, 2014 · 6 comments

Comments

@mousepotato
Copy link

if (root == null) {
  return -1;
}

应该是 return 0;

@yuzhangcmu
Copy link
Owner

你说的是哪一道题目?

这里应该是返回-1的。 九章算法有发过对数的各种定义的解析 ,你可以看一下。

Depth定义的是从根到最远的叶子节点的边的条数。
如果是只有根节点,应该是0.

如果是null 就应该是-1.

On Oct 9, 2014, at 10:08 AM, Shuangjiang Li notifications@github.com wrote:

if (root == null) {
return -1;
}
应该是 return 0;


Reply to this email directly or view it on GitHub.

@yuzhangcmu
Copy link
Owner

还有一个问题是 其实很多公司面试官对这个定义也不是特别清楚。 所以 在面试时 先问清楚他想要什么样的答案就行了。

On Oct 9, 2014, at 10:08 AM, Shuangjiang Li notifications@github.com wrote:

if (root == null) {
return -1;
}
应该是 return 0;


Reply to this email directly or view it on GitHub.

@mousepotato
Copy link
Author

谢谢解释。觉得你是对的!

@yuzhangcmu
Copy link
Owner

另外 你的名字实在是太霸气了!

On Fri, Oct 10, 2014 at 12:28 PM, Shuangjiang Li notifications@github.com
wrote:

谢谢解释。觉得你是对的!


Reply to this email directly or view it on GitHub
#1 (comment)
.

@mousepotato
Copy link
Author

哈哈,九章群里我也在。。

@yuzhangcmu
Copy link
Owner

给您跪下咯。
On Oct 14, 2014, at 5:10 PM, Shuangjiang Li notifications@github.com wrote:

哈哈,九章群里我也在。。


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants