mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-11 21:10:58 +08:00
调换leftNode、rightNode
This commit is contained in:
@ -224,8 +224,8 @@ public:
|
|||||||
st.push(root->left);
|
st.push(root->left);
|
||||||
st.push(root->right);
|
st.push(root->right);
|
||||||
while (!st.empty()) {
|
while (!st.empty()) {
|
||||||
TreeNode* leftNode = st.top(); st.pop();
|
|
||||||
TreeNode* rightNode = st.top(); st.pop();
|
TreeNode* rightNode = st.top(); st.pop();
|
||||||
|
TreeNode* leftNode = st.top(); st.pop();
|
||||||
if (!leftNode && !rightNode) {
|
if (!leftNode && !rightNode) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -950,3 +950,4 @@ public bool IsSymmetric(TreeNode root)
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user