mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-02 18:39:09 +08:00
更新代码块
This commit is contained in:
@@ -150,7 +150,7 @@ TreeNode* right = lowestCommonAncestor(root->right, p, q);
|
||||
|
||||
代码如下:
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
if (left == NULL && right != NULL) return right;
|
||||
else if (left != NULL && right == NULL) return left;
|
||||
else { // (left == NULL && right == NULL)
|
||||
@@ -167,7 +167,7 @@ else { // (left == NULL && right == NULL)
|
||||
|
||||
整体代码如下:
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
class Solution {
|
||||
public:
|
||||
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
|
||||
稍加精简,代码如下:
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
class Solution {
|
||||
public:
|
||||
TreeNode* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q) {
|
||||
|
||||
Reference in New Issue
Block a user