This commit is contained in:
2026-06-05 22:32:49 +08:00
parent 14d05011d5
commit c67841fe07
202 changed files with 498 additions and 403 deletions
@@ -43,7 +43,7 @@ Explanation: The root node's value is 5 but its right child's value is 4
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 98 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -55,7 +55,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 98
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -45,7 +45,7 @@ Output: false
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 100 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -57,7 +57,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 100
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -43,7 +43,7 @@ Output: []
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 102 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -55,7 +55,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 102
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -36,7 +36,7 @@ Output: 2
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 104 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -48,7 +48,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 104
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -44,7 +44,7 @@ Output: [-1]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 105 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -56,7 +56,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 105
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -43,7 +43,7 @@ Output: true
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 110 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -55,7 +55,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 110
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -40,7 +40,7 @@ Explanation: The optimal path is 15 -> 20 -> 7 with a path sum of 15 + 20 + 7 =
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 124 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -52,7 +52,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 124
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -44,7 +44,7 @@ Given the ~root~ of a binary tree, imagine yourself standing on the *right side*
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 199 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -56,7 +56,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 199
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -43,7 +43,7 @@ Output: []
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 226 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -55,7 +55,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 226
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -38,7 +38,7 @@ Output: 3
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 230 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -50,7 +50,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 230
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -53,7 +53,7 @@ Output: 2
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 235 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
@@ -66,7 +66,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 235
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -38,7 +38,7 @@ Output: []
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 297 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
@@ -71,7 +71,7 @@ class Codec:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 297
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -39,7 +39,7 @@ Output: 1
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 543 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -51,7 +51,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 543
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -40,7 +40,7 @@ Output: false
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 572 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -52,7 +52,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 572
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -40,7 +40,7 @@ Output: [2,6,14,11,7,3,12,8,4,13,9,10,5,1]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 590 :lc-lang python3
"""
# Definition for a Node.
class Node:
@@ -54,7 +54,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 590
/*
// Definition for a Node.
class Node {
@@ -49,7 +49,7 @@ Output: [1,401,null,349,88,90]
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1028 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -61,7 +61,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1028
/**
* Definition for a binary tree node.
* struct TreeNode {
@@ -59,13 +59,13 @@ The tree structure of the employees in the company is shown.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1376 :lc-lang python3
class Solution:
def numOfMinutes(self, n: int, headID: int, manager: List[int], informTime: List[int]) -> int:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1376
class Solution {
public:
int numOfMinutes(int n, int headID, vector<int>& manager, vector<int>& informTime) {
@@ -56,7 +56,7 @@ Explanation: Root is considered as good.
Write your approach here.
** TODO Python
#+begin_src python
#+begin_src python :lc-problem 1448 :lc-lang python3
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
@@ -68,7 +68,7 @@ class Solution:
#+end_src
** TODO C++
#+begin_src cpp
#+begin_src cpp :lc-problem 1448
/**
* Definition for a binary tree node.
* struct TreeNode {