调换leftNode、rightNode

This commit is contained in:
iteng
2024-05-25 17:26:43 +08:00
parent c17953b478
commit 5073196a10

View File

@ -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>