Google实习生算法面试真题 我反正蒙了
Boolean expression:
0 false
1 true
2 OR||
3 AND&&
4 XOR ^
5 NOT !
Binary Tree:
3 (F)
/ \
5(F) 4(F)
/ / \
2(T) 1 1
/ \
1 0
current result = false
desired result: true
In one operation, you can flip any leaf.
Return the minimum number operations that need to be done such that evaluation of root yields desired result.
3 (T)
/ \
5(T) 4(T)
/ / \
2(F) 1 0 1
/ \
1 0 0
return 2
dp➕二叉树遍历 真有意思🤔
0 false
1 true
2 OR||
3 AND&&
4 XOR ^
5 NOT !
Binary Tree:
3 (F)
/ \
5(F) 4(F)
/ / \
2(T) 1 1
/ \
1 0
current result = false
desired result: true
In one operation, you can flip any leaf.
Return the minimum number operations that need to be done such that evaluation of root yields desired result.
3 (T)
/ \
5(T) 4(T)
/ / \
2(F) 1 0 1
/ \
1 0 0
return 2
dp➕二叉树遍历 真有意思🤔
全部评论
相关推荐