diff --git a/solution/0900-0999/0977.Squares of a Sorted Array/README.md b/solution/0900-0999/0977.Squares of a Sorted Array/README.md index 7914c669e8f55..42f2dbbded508 100644 --- a/solution/0900-0999/0977.Squares of a Sorted Array/README.md +++ b/solution/0900-0999/0977.Squares of a Sorted Array/README.md @@ -23,7 +23,7 @@ tags:
+
示例 1:
@@ -40,22 +40,22 @@ tags: 输出:[4,9,9,49,121] -+
提示:
1 <= nums.length <= 104
-104 <= nums[i] <= 104
1 <= nums.length <= 104
-104 <= nums[i] <= 104
nums
已按 非递减顺序 排序+
进阶:
O(n)
的算法解决本问题O(n)
的算法解决本问题1
的绳子。你的任务是找出最大 x
值,要求满足可以裁切出至少 k
条长度均为 x
的绳子。你可以丢弃裁切后剩余的任意长度的绳子。如果不可能切割出 k
条相同长度的绳子,返回 0。
你的任务是找出最大 x
值,要求满足可以裁切出恰好 k
条长度均为 x
的绳子。你可以丢弃裁切后剩余的任意长度的绳子。如果不可能切割出 k
条相同长度的绳子,返回 0。
diff --git a/solution/3300-3399/3369.Design an Array Statistics Tracker/README.md b/solution/3300-3399/3369.Design an Array Statistics Tracker/README.md index ea1bedc26c2bd..7b79ae1d4f69a 100644 --- a/solution/3300-3399/3369.Design an Array Statistics Tracker/README.md +++ b/solution/3300-3399/3369.Design an Array Statistics Tracker/README.md @@ -3,9 +3,13 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3369.Design%20an%20Array%20Statistics%20Tracker/README.md tags: + - 设计 - 队列 - 哈希表 - 二分查找 + - 数据流 + - 有序集合 + - 堆(优先队列) --- diff --git a/solution/3300-3399/3369.Design an Array Statistics Tracker/README_EN.md b/solution/3300-3399/3369.Design an Array Statistics Tracker/README_EN.md index 4ac3c14827b39..0861da2b522ad 100644 --- a/solution/3300-3399/3369.Design an Array Statistics Tracker/README_EN.md +++ b/solution/3300-3399/3369.Design an Array Statistics Tracker/README_EN.md @@ -3,9 +3,13 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3369.Design%20an%20Array%20Statistics%20Tracker/README_EN.md tags: + - Design - Queue - Hash Table - Binary Search + - Data Stream + - Ordered Set + - Heap (Priority Queue) --- diff --git a/solution/3300-3399/3376.Minimum Time to Break Locks I/README_EN.md b/solution/3300-3399/3376.Minimum Time to Break Locks I/README_EN.md index 6f00900f768a0..2ca40e558bf1a 100644 --- a/solution/3300-3399/3376.Minimum Time to Break Locks I/README_EN.md +++ b/solution/3300-3399/3376.Minimum Time to Break Locks I/README_EN.md @@ -26,10 +26,10 @@ tags:
X
by which the energy of the sword increases is 1.X
.x
by which the energy of the sword increases is 1.x
.ith
lock, the energy of the sword must reach at least strength[i]
.X
increases by a given value K
.x
increases by a given value k
.Your task is to determine the minimum time in minutes required for Bob to break all n
locks and escape the dungeon.
Example 1:
Input: strength = [3,4,1], K = 1
+Input: strength = [3,4,1], k = 1
Output: 4
@@ -51,9 +51,9 @@ tags:Example 2:
Input: strength = [2,5,4], K = 2
+Input: strength = [2,5,4], k = 2
Output: 5
@@ -110,9 +110,9 @@ tags:如果数组 nums
的一个分割满足以下条件,我们称它是一个 美丽 分割:
nums
分为三段 非空子数组:nums1
,nums2
和 nums3
,三个数组 nums1
,nums2
和 nums3
按顺序连接可以得到 nums
。nums1
是子数组 nums2
的前缀 或者 nums2
是 nums3
的前缀。nums
分为三段 非空子数组:nums1
,nums2
和 nums3
,三个数组 nums1
,nums2
和 nums3
按顺序连接可以得到 nums
。nums1
是子数组 nums2
的 前缀 或者 nums2
是 nums3
的 前缀。请你返回满足以上条件的分割 数目 。
diff --git a/solution/3300-3399/3388.Count Beautiful Splits in an Array/README_EN.md b/solution/3300-3399/3388.Count Beautiful Splits in an Array/README_EN.md index 92562c3606a5e..e4f3d20a9b36c 100644 --- a/solution/3300-3399/3388.Count Beautiful Splits in an Array/README_EN.md +++ b/solution/3300-3399/3388.Count Beautiful Splits in an Array/README_EN.md @@ -2,6 +2,9 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3388.Count%20Beautiful%20Splits%20in%20an%20Array/README_EN.md +tags: + - Array + - Dynamic Programming --- diff --git a/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README.md b/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README.md index 47afde02be219..5b0de363c753a 100644 --- a/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README.md +++ b/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README.md @@ -2,6 +2,12 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3389.Minimum%20Operations%20to%20Make%20Character%20Frequencies%20Equal/README.md +tags: + - 哈希表 + - 字符串 + - 动态规划 + - 计数 + - 枚举 --- diff --git a/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README_EN.md b/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README_EN.md index df08aed560173..90c7c91f8781f 100644 --- a/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README_EN.md +++ b/solution/3300-3399/3389.Minimum Operations to Make Character Frequencies Equal/README_EN.md @@ -2,6 +2,12 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3389.Minimum%20Operations%20to%20Make%20Character%20Frequencies%20Equal/README_EN.md +tags: + - Hash Table + - String + - Dynamic Programming + - Counting + - Enumeration --- diff --git a/solution/3300-3399/3391.Design a 3D Binary Matrix with Efficient Layer Tracking/README.md b/solution/3300-3399/3391.Design a 3D Binary Matrix with Efficient Layer Tracking/README.md new file mode 100644 index 0000000000000..73d1970b665e9 --- /dev/null +++ b/solution/3300-3399/3391.Design a 3D Binary Matrix with Efficient Layer Tracking/README.md @@ -0,0 +1,247 @@ +--- +comments: true +difficulty: 中等 +edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3391.Design%20a%203D%20Binary%20Matrix%20with%20Efficient%20Layer%20Tracking/README.md +--- + + + +# [3391. Design a 3D Binary Matrix with Efficient Layer Tracking 🔒](https://leetcode.cn/problems/design-a-3d-binary-matrix-with-efficient-layer-tracking) + +[English Version](/solution/3300-3399/3391.Design%20a%203D%20Binary%20Matrix%20with%20Efficient%20Layer%20Tracking/README_EN.md) + +## 题目描述 + + + +You are given a n x n x n
binary 3D array matrix
.
Implement the matrix3D
class:
matrix3D(int n)
Initializes the object with the 3D binary array matrix
, where all elements are initially set to 0.void setCell(int x, int y, int z)
Sets the value at matrix[x][y][z]
to 1.void unsetCell(int x, int y, int z)
Sets the value at matrix[x][y][z]
to 0.int largestMatrix()
Returns the index x
where matrix[x]
contains the most number of 1's. If there are multiple such indices, return the largest x
.+
Example 1:
+ +Input:
+["matrix3D", "setCell", "largestMatrix", "setCell", "largestMatrix", "setCell", "largestMatrix"]
+[[3], [0, 0, 0], [], [1, 1, 2], [], [0, 0, 1], []]
Output:
+[null, null, 0, null, 1, null, 0]
Explanation
+matrix3D matrix3D = new matrix3D(3); // Initializes a3 x 3 x 3
3D array matrix
, filled with all 0's.matrix[0][0][0]
to 1.matrix[0]
has the most number of 1's.matrix[1][1][2]
to 1.matrix[0]
and matrix[1]
tie with the most number of 1's, but index 1 is bigger.matrix[0][0][1]
to 1.matrix[0]
has the most number of 1's.Example 2:
+ +Input:
+["matrix3D", "setCell", "largestMatrix", "unsetCell", "largestMatrix"]
+[[4], [2, 1, 1], [], [2, 1, 1], []]
Output:
+[null, null, 2, null, 3]
Explanation
+matrix3D matrix3D = new matrix3D(4); // Initializes a4 x 4 x 4
3D array matrix
, filled with all 0's.matrix[2][1][1]
to 1.matrix[2]
has the most number of 1's.matrix[2][1][1]
to 0.+
Constraints:
+ +1 <= n <= 100
0 <= x, y, z < n
105
calls are made in total to setCell
and unsetCell
.104
calls are made to largestMatrix
.You are given a n x n x n
binary 3D array matrix
.
Implement the matrix3D
class:
matrix3D(int n)
Initializes the object with the 3D binary array matrix
, where all elements are initially set to 0.void setCell(int x, int y, int z)
Sets the value at matrix[x][y][z]
to 1.void unsetCell(int x, int y, int z)
Sets the value at matrix[x][y][z]
to 0.int largestMatrix()
Returns the index x
where matrix[x]
contains the most number of 1's. If there are multiple such indices, return the largest x
.+
Example 1:
+ +Input:
+["matrix3D", "setCell", "largestMatrix", "setCell", "largestMatrix", "setCell", "largestMatrix"]
+[[3], [0, 0, 0], [], [1, 1, 2], [], [0, 0, 1], []]
Output:
+[null, null, 0, null, 1, null, 0]
Explanation
+matrix3D matrix3D = new matrix3D(3); // Initializes a3 x 3 x 3
3D array matrix
, filled with all 0's.matrix[0][0][0]
to 1.matrix[0]
has the most number of 1's.matrix[1][1][2]
to 1.matrix[0]
and matrix[1]
tie with the most number of 1's, but index 1 is bigger.matrix[0][0][1]
to 1.matrix[0]
has the most number of 1's.Example 2:
+ +Input:
+["matrix3D", "setCell", "largestMatrix", "unsetCell", "largestMatrix"]
+[[4], [2, 1, 1], [], [2, 1, 1], []]
Output:
+[null, null, 2, null, 3]
Explanation
+matrix3D matrix3D = new matrix3D(4); // Initializes a4 x 4 x 4
3D array matrix
, filled with all 0's.matrix[2][1][1]
to 1.matrix[2]
has the most number of 1's.matrix[2][1][1]
to 0.+
Constraints:
+ +1 <= n <= 100
0 <= x, y, z < n
105
calls are made in total to setCell
and unsetCell
.104
calls are made to largestMatrix
.