c*g
2 楼
我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
int
Tree::getDepth(Node* head) {
if(head == NULL) return 0;
if(head->left == NULL && head->right == NULL) return 0;
int left = getDepth(head->left)+1;
int right = getDepth(head->right)+1;
return (left > right)?left:right;
}
bool
Tree::isBalanced(Node* head) {
if(head == NULL ) return true;
return (isBalanced(head->left)
&& isBalanced(head->right)
&& abs(getDepth(head->left) - getDepth(head->right))<=1) ;
}
int
Tree::getDepth(Node* head) {
if(head == NULL) return 0;
if(head->left == NULL && head->right == NULL) return 0;
int left = getDepth(head->left)+1;
int right = getDepth(head->right)+1;
return (left > right)?left:right;
}
bool
Tree::isBalanced(Node* head) {
if(head == NULL ) return true;
return (isBalanced(head->left)
&& isBalanced(head->right)
&& abs(getDepth(head->left) - getDepth(head->right))<=1) ;
}
l*l
3 楼
有跟我SAME BOAT吗?求祝福,攒RP,TSC 加油。
v*e
4 楼
how to solve this?
x*e
5 楼
https://www.williams-sonoma.com/products/staub-round-cocotte/?pkey=e%7CStaub
%2BCast-Iron%7C43%7Cbest%7C0%7Cviewall%7C24%7C%7C9&cm_src=PRODUCTSEARCH
%2BCast-Iron%7C43%7Cbest%7C0%7Cviewall%7C24%7C%7C9&cm_src=PRODUCTSEARCH
l*a
6 楼
你把corner case作为你程序的测试项不好吗?
【在 c***g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
: int
: Tree::getDepth(Node* head) {
:
: if(head == NULL) return 0;
: if(head->left == NULL && head->right == NULL) return 0;
: int left = getDepth(head->left)+1;
: int right = getDepth(head->right)+1;
: return (left > right)?left:right;
: }
【在 c***g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
: int
: Tree::getDepth(Node* head) {
:
: if(head == NULL) return 0;
: if(head->left == NULL && head->right == NULL) return 0;
: int left = getDepth(head->left)+1;
: int right = getDepth(head->right)+1;
: return (left > right)?left:right;
: }
p*m
7 楼
我和你差不多 TSC RD 3/7号。。今天去找律师PP。希望能通过
v*e
8 楼
android
g*d
11 楼
我的4/19, 也没动静。只说接受了。tsc.
w*y
12 楼
第一次用?装Google拼音。还有什么百度、sougou之类的。
a*3
13 楼
干什么用的?
l*l
15 楼
过晕了,是4月15号PP的,刷屏刷的脑子都不好使了。哈哈
B*1
17 楼
弱问
if(head->left == NULL && head->right == NULL) return 0;
不是return 1?
if(head->left == NULL && head->right == NULL) return 0;
不是return 1?
s*c
18 楼
说好的15天呢?bless。
w*s
19 楼
已经买了,要到明年1月份才寄出来
B*1
20 楼
if(head == NULL) return 0;
if(head->left == NULL && head->right == NULL) return 0;
这code是不是有点啰嗦啊,
只是if(head == NULL) return 0; 就够了吧。
if(head->left == NULL && head->right == NULL) return 0;
这code是不是有点啰嗦啊,
只是if(head == NULL) return 0; 就够了吧。
g*2
21 楼
bless~
c*n
22 楼
哇塞 7qt
我家5qt我觉得都有点买大了
上次以外发现小的锅子拿来煎牛排不错 比pan多了周围一圈 少了不少烧好了擦炉灶的
工作量
我家5qt我觉得都有点买大了
上次以外发现小的锅子拿来煎牛排不错 比pan多了周围一圈 少了不少烧好了擦炉灶的
工作量
z*8
24 楼
Same here. 我在想是不是TSC的full name check的确要花时间。
r*n
26 楼
return (maxDep(r) - minDep(r)) > 1
def maxDep(r):
if r == None: return 0
else:
return 1 + max(maxDep(r.left),maxDep(r.right))
def minDep(r):...
【在 c***g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
: int
: Tree::getDepth(Node* head) {
:
: if(head == NULL) return 0;
: if(head->left == NULL && head->right == NULL) return 0;
: int left = getDepth(head->left)+1;
: int right = getDepth(head->right)+1;
: return (left > right)?left:right;
: }
def maxDep(r):
if r == None: return 0
else:
return 1 + max(maxDep(r.left),maxDep(r.right))
def minDep(r):...
【在 c***g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
: int
: Tree::getDepth(Node* head) {
:
: if(head == NULL) return 0;
: if(head->left == NULL && head->right == NULL) return 0;
: int left = getDepth(head->left)+1;
: int right = getDepth(head->right)+1;
: return (left > right)?left:right;
: }
B*1
29 楼
http://www.geeksforgeeks.org/archives/5230
int height(struct node* node)
{
/* base case tree is empty */
if(node == NULL)
return 0;
/* If tree is not empty then height = 1 + max of left
height and right heights */
return 1 + max(height(node->left), height(node->right));
}
【在 c***g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 如果一个根节点,一个叶子节点,depth是1 吧?
int height(struct node* node)
{
/* base case tree is empty */
if(node == NULL)
return 0;
/* If tree is not empty then height = 1 + max of left
height and right heights */
return 1 + max(height(node->left), height(node->right));
}
【在 c***g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 如果一个根节点,一个叶子节点,depth是1 吧?
d*w
32 楼
这里面有不少重复计算吧,我面试时也遇到,面试官希望扫描一遍tree就判断出来
int isB(Tree t){
if(!t) return 0;
int left=isB(t.left);
int right=isB(t.right);
if( left >=0 && right >=0 && left - right <= 1 || left -right >=-1)
return (left else return -1;
}
【在 c***g 的大作中提到】![](/moin_static193/solenoid/img/up.png)
: 我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
: int
: Tree::getDepth(Node* head) {
:
: if(head == NULL) return 0;
: if(head->left == NULL && head->right == NULL) return 0;
: int left = getDepth(head->left)+1;
: int right = getDepth(head->right)+1;
: return (left > right)?left:right;
: }
int isB(Tree t){
if(!t) return 0;
int left=isB(t.left);
int right=isB(t.right);
if( left >=0 && right >=0 && left - right <= 1 || left -right >=-1)
return (left
}
【在 c***g 的大作中提到】
![](/moin_static193/solenoid/img/up.png)
: 我个人对自己的corner case的考虑一向没有信心,请各位大侠调教一下
: int
: Tree::getDepth(Node* head) {
:
: if(head == NULL) return 0;
: if(head->left == NULL && head->right == NULL) return 0;
: int left = getDepth(head->left)+1;
: int right = getDepth(head->right)+1;
: return (left > right)?left:right;
: }
Q*F
33 楼
我同事4.17PP, 今天批准,但是网上状态没有更新。是律师收到的批准信.
有时候网上的状态更新不及时
有时候网上的状态更新不及时
j*3
36 楼
这种昂贵的牌子能比中国产的Lodge煮出来的好吃吗?
Q*F
37 楼
YES
j*3
38 楼
这种昂贵的牌子能比中国产的Lodge煮出来的好吃吗?
相关阅读
谷轮三轮为什么看大家都买果果大不悦呢? (转载)android tablet 如何才能正常播放本版的歌曲? (转载)这里瞬间变成了果版android app 升级失败怎么搞怎么又删帖了,理亏怕被人知道?。。。刚才是不是没有提电池从密泄得这么完全来看,果果确实要下滑了关于ipad重大发现果轮会高潮么?有谁在vitality上面装成功igo primo的?AT&T / Verizon One X / GS3推荐一款带回国可以用的智能手机吧?Nokia lumia 920 Best cell phone of 2012请教手机翻译词典软件,口语学习软件有没有人具体给讲讲AT&T自动charge data plan是咋回事Verizon samsung galaxy s3容易root么?哪位大侠能传一个TA 2011Q3的premium POI啊mk802用什么输入法?以后苹果发布会改叫“确认会”算了Thinkpad还是经典