diff --git a/solution/0600-0699/0626.Exchange Seats/README_EN.md b/solution/0600-0699/0626.Exchange Seats/README_EN.md index d3e57efc6fcf7..7294bad1c7d1a 100644 --- a/solution/0600-0699/0626.Exchange Seats/README_EN.md +++ b/solution/0600-0699/0626.Exchange Seats/README_EN.md @@ -27,7 +27,7 @@ tags: +-------------+---------+ id is the primary key (unique value) column for this table. Each row of this table indicates the name and the ID of a student. -id is a continuous increment. +The ID sequence always starts from 1 and increments continuously.

 

diff --git a/solution/0600-0699/0690.Employee Importance/README.md b/solution/0600-0699/0690.Employee Importance/README.md index 8857d26a2a465..dc7f3aab0c8a2 100644 --- a/solution/0600-0699/0690.Employee Importance/README.md +++ b/solution/0600-0699/0690.Employee Importance/README.md @@ -172,6 +172,8 @@ public: }; ``` +#### Go + ```go /** * Definition for Employee. diff --git a/solution/0600-0699/0690.Employee Importance/README_EN.md b/solution/0600-0699/0690.Employee Importance/README_EN.md index 5e6a1adf6773b..2ee3ac9f9cea8 100644 --- a/solution/0600-0699/0690.Employee Importance/README_EN.md +++ b/solution/0600-0699/0690.Employee Importance/README_EN.md @@ -165,6 +165,8 @@ public: }; ``` +#### Go + ```go /** * Definition for Employee. diff --git a/solution/1000-1099/1052.Grumpy Bookstore Owner/README_EN.md b/solution/1000-1099/1052.Grumpy Bookstore Owner/README_EN.md index 68a5c920b0c3c..d87b1856b8556 100644 --- a/solution/1000-1099/1052.Grumpy Bookstore Owner/README_EN.md +++ b/solution/1000-1099/1052.Grumpy Bookstore Owner/README_EN.md @@ -19,32 +19,38 @@ tags: -

There is a bookstore owner that has a store open for n minutes. Every minute, some number of customers enter the store. You are given an integer array customers of length n where customers[i] is the number of the customer that enters the store at the start of the ith minute and all those customers leave after the end of that minute.

+

There is a bookstore owner that has a store open for n minutes. You are given an integer array customers of length n where customers[i] is the number of the customers that enter the store at the start of the ith minute and all those customers leave after the end of that minute.

-

On some minutes, the bookstore owner is grumpy. You are given a binary array grumpy where grumpy[i] is 1 if the bookstore owner is grumpy during the ith minute, and is 0 otherwise.

+

During certain minutes, the bookstore owner is grumpy. You are given a binary array grumpy where grumpy[i] is 1 if the bookstore owner is grumpy during the ith minute, and is 0 otherwise.

-

When the bookstore owner is grumpy, the customers of that minute are not satisfied, otherwise, they are satisfied.

+

When the bookstore owner is grumpy, the customers entering during that minute are not satisfied. Otherwise, they are satisfied.

-

The bookstore owner knows a secret technique to keep themselves not grumpy for minutes consecutive minutes, but can only use it once.

+

The bookstore owner knows a secret technique to remain not grumpy for minutes consecutive minutes, but this technique can only be used once.

-

Return the maximum number of customers that can be satisfied throughout the day.

+

Return the maximum number of customers that can be satisfied throughout the day.

 

Example 1:

-
-Input: customers = [1,0,1,2,1,1,7,5], grumpy = [0,1,0,1,0,1,0,1], minutes = 3
-Output: 16
-Explanation: The bookstore owner keeps themselves not grumpy for the last 3 minutes. 
-The maximum number of customers that can be satisfied = 1 + 1 + 1 + 1 + 7 + 5 = 16.
-
+
+

Input: customers = [1,0,1,2,1,1,7,5], grumpy = [0,1,0,1,0,1,0,1], minutes = 3

+ +

Output: 16

+ +

Explanation:

+ +

The bookstore owner keeps themselves not grumpy for the last 3 minutes.

+ +

The maximum number of customers that can be satisfied = 1 + 1 + 1 + 1 + 7 + 5 = 16.

+

Example 2:

-
-Input: customers = [1], grumpy = [0], minutes = 1
-Output: 1
-
+
+

Input: customers = [1], grumpy = [0], minutes = 1

+ +

Output: 1

+

 

Constraints:

diff --git a/solution/1100-1199/1152.Analyze User Website Visit Pattern/README_EN.md b/solution/1100-1199/1152.Analyze User Website Visit Pattern/README_EN.md index bc8f7c9ed7aab..068e467a7a42c 100644 --- a/solution/1100-1199/1152.Analyze User Website Visit Pattern/README_EN.md +++ b/solution/1100-1199/1152.Analyze User Website Visit Pattern/README_EN.md @@ -36,7 +36,9 @@ tags:
  • Also, if the pattern is ["luffy", "luffy", "luffy"], the score is the number of users x such that x visited "luffy" three different times at different timestamps.
  • -

    Return the pattern with the largest score. If there is more than one pattern with the same largest score, return the lexicographically smallest such pattern.

    +

    Return the pattern with the largest score. If there is more than one pattern with the same largest score, return the lexicographically smallest such pattern.

    + +

    Note that the websites in a pattern do not need to be visited contiguously, they only need to be visited in the order they appeared in the pattern.

     

    Example 1:

    diff --git a/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/README_EN.md b/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/README_EN.md index 283121786a480..a7fdf018480cd 100644 --- a/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/README_EN.md +++ b/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/README_EN.md @@ -28,7 +28,9 @@ tags:

     

    Example 1:

    - + +

    +
     Input: n = 4, edges = [[0,1,3],[1,2,1],[1,3,4],[2,3,1]], distanceThreshold = 4
     Output: 3
    @@ -42,7 +44,9 @@ Cities 0 and 3 have 2 neighboring cities at a distanceThreshold = 4, but we have
     

    Example 2:

    - + +

    +
     Input: n = 5, edges = [[0,1,2],[0,4,8],[1,2,3],[1,4,2],[2,3,1],[3,4,1]], distanceThreshold = 2
     Output: 0
    diff --git a/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/images/problem1334example0.png b/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/images/problem1334example0.png
    new file mode 100644
    index 0000000000000..fd200ef2164e4
    Binary files /dev/null and b/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/images/problem1334example0.png differ
    diff --git a/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/images/problem1334example1.png b/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/images/problem1334example1.png
    new file mode 100644
    index 0000000000000..64c05426b4bc0
    Binary files /dev/null and b/solution/1300-1399/1334.Find the City With the Smallest Number of Neighbors at a Threshold Distance/images/problem1334example1.png differ
    diff --git a/solution/1300-1399/1341.Movie Rating/README_EN.md b/solution/1300-1399/1341.Movie Rating/README_EN.md
    index 2f14e746d8558..c65ffd00f52f0 100644
    --- a/solution/1300-1399/1341.Movie Rating/README_EN.md	
    +++ b/solution/1300-1399/1341.Movie Rating/README_EN.md	
    @@ -41,10 +41,9 @@ title is the name of the movie.
     | name          | varchar |
     +---------------+---------+
     user_id is the primary key (column with unique values) for this table.
    +The column 'name' has unique values.
     
    -

     

    -

    Table: MovieRating

    @@ -56,7 +55,7 @@ user_id is the primary key (column with unique values) for this table.
     | rating        | int     |
     | created_at    | date    |
     +---------------+---------+
    -(movie_id, user_id) is the primary key (column with unique values) for this table.
    +(movie_id, user_id) is the primary key (column with unique values) for this table.
     This table contains the rating of a movie by a user in their review.
     created_at is the user's review date. 
     
    diff --git a/solution/1400-1499/1462.Course Schedule IV/README_EN.md b/solution/1400-1499/1462.Course Schedule IV/README_EN.md index 8f05842d9bb4f..bd4cb9b54f6bc 100644 --- a/solution/1400-1499/1462.Course Schedule IV/README_EN.md +++ b/solution/1400-1499/1462.Course Schedule IV/README_EN.md @@ -65,12 +65,12 @@ Course 0 is not a prerequisite of course 1, but the opposite is true.
  • 2 <= numCourses <= 100
  • 0 <= prerequisites.length <= (numCourses * (numCourses - 1) / 2)
  • prerequisites[i].length == 2
  • -
  • 0 <= ai, bi <= n - 1
  • +
  • 0 <= ai, bi <= numCourses - 1
  • ai != bi
  • All the pairs [ai, bi] are unique.
  • The prerequisites graph has no cycles.
  • 1 <= queries.length <= 104
  • -
  • 0 <= ui, vi <= n - 1
  • +
  • 0 <= ui, vi <= numCourses - 1
  • ui != vi
  • diff --git a/solution/1700-1799/1798.Maximum Number of Consecutive Values You Can Make/README_EN.md b/solution/1700-1799/1798.Maximum Number of Consecutive Values You Can Make/README_EN.md index 8ab9fa03ea0b7..ac009abc97397 100644 --- a/solution/1700-1799/1798.Maximum Number of Consecutive Values You Can Make/README_EN.md +++ b/solution/1700-1799/1798.Maximum Number of Consecutive Values You Can Make/README_EN.md @@ -56,7 +56,7 @@ You can make 8 consecutive integer values starting from 0.

    Example 3:

    -Input: nums = [1,4,10,3,1]
    +Input: coins = [1,4,10,3,1]
     Output: 20

     

    diff --git a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README.md b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README.md index b7dc7b03596aa..907de5036c28b 100644 --- a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README.md +++ b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README.md @@ -314,7 +314,7 @@ function getDirections(root: TreeNode | null, startValue: number, destValue: num const left = lca(node.left, p, q); const right = lca(node.right, p, q); - return left && right ? node : left ?? right; + return left && right ? node : (left ?? right); }; const dfs = (node: TreeNode | null, x: number, path: string[]): boolean => { @@ -370,7 +370,7 @@ var getDirections = function (root, startValue, destValue) { const left = lca(node.left, p, q); const right = lca(node.right, p, q); - return left && right ? node : left ?? right; + return left && right ? node : (left ?? right); }; const dfs = (node, x, path) => { diff --git a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README_EN.md b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README_EN.md index 41a9811d4e980..58782483df639 100644 --- a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README_EN.md +++ b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/README_EN.md @@ -310,7 +310,7 @@ function getDirections(root: TreeNode | null, startValue: number, destValue: num const left = lca(node.left, p, q); const right = lca(node.right, p, q); - return left && right ? node : left ?? right; + return left && right ? node : (left ?? right); }; const dfs = (node: TreeNode | null, x: number, path: string[]): boolean => { @@ -366,7 +366,7 @@ var getDirections = function (root, startValue, destValue) { const left = lca(node.left, p, q); const right = lca(node.right, p, q); - return left && right ? node : left ?? right; + return left && right ? node : (left ?? right); }; const dfs = (node, x, path) => { diff --git a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.js b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.js index c6ca93d60610d..cf11074f0553b 100644 --- a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.js +++ b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.js @@ -20,7 +20,7 @@ var getDirections = function (root, startValue, destValue) { const left = lca(node.left, p, q); const right = lca(node.right, p, q); - return left && right ? node : left ?? right; + return left && right ? node : (left ?? right); }; const dfs = (node, x, path) => { diff --git a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.ts b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.ts index fa2f24e5d72b9..5c028830da797 100644 --- a/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.ts +++ b/solution/2000-2099/2096.Step-By-Step Directions From a Binary Tree Node to Another/Solution.ts @@ -20,7 +20,7 @@ function getDirections(root: TreeNode | null, startValue: number, destValue: num const left = lca(node.left, p, q); const right = lca(node.right, p, q); - return left && right ? node : left ?? right; + return left && right ? node : (left ?? right); }; const dfs = (node: TreeNode | null, x: number, path: string[]): boolean => { diff --git a/solution/3100-3199/3102.Minimize Manhattan Distances/README_EN.md b/solution/3100-3199/3102.Minimize Manhattan Distances/README_EN.md index 7613013109450..14ffe4e189cb6 100644 --- a/solution/3100-3199/3102.Minimize Manhattan Distances/README_EN.md +++ b/solution/3100-3199/3102.Minimize Manhattan Distances/README_EN.md @@ -22,7 +22,7 @@ tags: -

    You are given a array points representing integer coordinates of some points on a 2D plane, where points[i] = [xi, yi].

    +

    You are given an array points representing integer coordinates of some points on a 2D plane, where points[i] = [xi, yi].

    The distance between two points is defined as their Manhattan distance.

    diff --git a/solution/3100-3199/3112.Minimum Time to Visit Disappearing Nodes/README_EN.md b/solution/3100-3199/3112.Minimum Time to Visit Disappearing Nodes/README_EN.md index 5d150f2fbba32..6ad8b30555db9 100644 --- a/solution/3100-3199/3112.Minimum Time to Visit Disappearing Nodes/README_EN.md +++ b/solution/3100-3199/3112.Minimum Time to Visit Disappearing Nodes/README_EN.md @@ -25,22 +25,22 @@ tags:

    Additionally, you are given an array disappear, where disappear[i] denotes the time when the node i disappears from the graph and you won't be able to visit it.

    -

    Notice that the graph might be disconnected and might contain multiple edges.

    +

    Note that the graph might be disconnected and might contain multiple edges.

    Return the array answer, with answer[i] denoting the minimum units of time required to reach node i from node 0. If node i is unreachable from node 0 then answer[i] is -1.

     

    Example 1:

    -

    -
    -

    Input: n = 3, edges = [[0,1,2],[1,2,1],[0,2,4]], disappear = [1,1,5]

    +

    Input: n = 3, edges = [[0,1,2],[1,2,1],[0,2,4]], disappear = [1,1,5]

    -

    Output: [0,-1,4]

    +

    Output: [0,-1,4]

    Explanation:

    +

    +

    We are starting our journey from node 0, and our goal is to find the minimum time required to reach each node before it disappears.