題號;100 標題:Same Tree 難度;Easy
Given the roots of two binary trees p and q, write a function to check if they are the same or not.
Two binary trees are considered the same if they are structurally identical, and the nodes have the same value.



Constraints:
The number of nodes in both trees is in the range [0, 100].
-104 <= Node.val <= 104
我的程式碼
/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */
bool checkR();
bool checkL(struct TreeNode* a, struct TreeNode* b){
    if((a == NULL &&  b != NULL)||(a != NULL &&  b == NULL) ){
        return false;
    }else if(a == NULL &&  b == NULL) {
        return true;
    }else if(a->val != b->val){
        return false;
    }else{
       return (checkR(a->right,b->right) && checkL(a->left,b->left)); 
    }
    return true;
}
bool checkR(struct TreeNode* c, struct TreeNode* d){
    if((c == NULL &&  d != NULL)||(c != NULL &&  d == NULL) ){
        return false;
    }else if(c == NULL &&  d == NULL){
        return true;
    }else if(c->val != d->val){
        return false;
    }else{
       return (checkR(c->right,d->right) && checkL(c->left,d->left)); 
    }
    return true;
}
bool isSameTree(struct TreeNode* p, struct TreeNode* q){
    if((p == NULL &&  q != NULL)||(p != NULL &&  q == NULL) ){
        return false;
    }else if(p == NULL &&  q == NULL){
        return true;
    }else if(p->val != q->val){
        return false;
    }else{
        return (checkL(p->left,q->left) && checkR(p->right,q->right));
    }
    return true;
}
邏輯
檢查每個節點的左邊跟右邊是否相等,不相等就return false
花比較多的時間在
資料結構的理解跟遞迴
題號:620 標題:Not Boring Movies 難度:Easy
Table: Cinema

id is the primary key for this table.
Each row contains information about the name of a movie, its genre, and its rating.
rating is a 2 decimal places float in the range [0, 10]
Write an SQL query to report the movies with an odd-numbered ID and a description that is not "boring".
Return the result table in descending order by rating.
The query result format is in the following example:
Cinema table:
Result table:
We have three movies with odd-numbered ID: 1, 3, and 5. The movie with ID = 3 is boring so we don't include it in the answer.
SQL指令
select * from Cinema where ((id%2) <> 0 ) and description <> "boring"  order by rating  desc;
DAY8心得
上班好累