Skip to content

feat: add solutions to lc problem: No.3391 #3871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions solution/0900-0999/0977.Squares of a Sorted Array/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tags:
<ul>
</ul>

<p>&nbsp;</p>
<p> </p>

<p><strong>示例 1:</strong></p>

Expand All @@ -40,22 +40,22 @@ tags:
<strong>输出:</strong>[4,9,9,49,121]
</pre>

<p>&nbsp;</p>
<p> </p>

<p><strong>提示:</strong></p>

<ul>
<li><code><span>1 &lt;= nums.length &lt;= </span>10<sup>4</sup></code></li>
<li><code>-10<sup>4</sup> &lt;= nums[i] &lt;= 10<sup>4</sup></code></li>
<li><code><span>1 <= nums.length <= </span>10<sup>4</sup></code></li>
<li><code>-10<sup>4</sup> <= nums[i] <= 10<sup>4</sup></code></li>
<li><code>nums</code> 已按 <strong>非递减顺序</strong> 排序</li>
</ul>

<p>&nbsp;</p>
<p> </p>

<p><strong>进阶:</strong></p>

<ul>
<li>请你设计时间复杂度为 <code>O(n)</code> 的算法解决本问题</li>
<li>请你<span style="color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, Helvetica, Arial, sans-serif, &quot;Apple Color Emoji&quot;, &quot;Segoe UI Emoji&quot;; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">设计时间复杂度为 <code>O(n)</code> 的算法解决本问题</span></li>
</ul>

<!-- description:end -->
Expand Down
2 changes: 1 addition & 1 deletion solution/1800-1899/1891.Cutting Ribbons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tags:
<li>切割成四条长度为 <code>1</code>&nbsp;的绳子。</li>
</ul>

<p>你的任务是找出最大 <code>x</code> 值,要求满足可以裁切出至少&nbsp;<code>k</code> 条长度均为 <code>x</code> 的绳子。你可以丢弃裁切后剩余的任意长度的绳子。如果不可能切割出&nbsp;<code>k</code> 条相同长度的绳子,返回 0。</p>
<p>你的任务是找出最大 <code>x</code> 值,要求满足可以裁切出恰好 <code>k</code> 条长度均为 <code>x</code> 的绳子。你可以丢弃裁切后剩余的任意长度的绳子。如果不可能切割出&nbsp;<code>k</code> 条相同长度的绳子,返回 0。</p>

<p>&nbsp;</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- 设计
- 队列
- 哈希表
- 二分查找
- 数据流
- 有序集合
- 堆(优先队列)
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ tags:

<ul>
<li>The initial energy of the sword is 0.</li>
<li>The initial factor <code><font face="monospace">X</font></code> by which the energy of the sword increases is 1.</li>
<li>Every minute, the energy of the sword increases by the current factor <code>X</code>.</li>
<li>The initial factor <code><font face="monospace">x</font></code> by which the energy of the sword increases is 1.</li>
<li>Every minute, the energy of the sword increases by the current factor <code>x</code>.</li>
<li>To break the <code>i<sup>th</sup></code> lock, the energy of the sword must reach <strong>at least</strong> <code>strength[i]</code>.</li>
<li>After breaking a lock, the energy of the sword resets to 0, and the factor <code>X</code> increases by a given value <code>K</code>.</li>
<li>After breaking a lock, the energy of the sword resets to 0, and the factor <code>x</code> increases by a given value <code>k</code>.</li>
</ul>

<p>Your task is to determine the <strong>minimum</strong> time in minutes required for Bob to break all <code>n</code> locks and escape the dungeon.</p>
Expand All @@ -40,7 +40,7 @@ tags:
<p><strong class="example">Example 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">strength = [3,4,1], K = 1</span></p>
<p><strong>Input:</strong> <span class="example-io">strength = [3,4,1], k = 1</span></p>

<p><strong>Output:</strong> <span class="example-io">4</span></p>

Expand All @@ -51,9 +51,9 @@ tags:
<tr>
<th style="border: 1px solid black;">Time</th>
<th style="border: 1px solid black;">Energy</th>
<th style="border: 1px solid black;">X</th>
<th style="border: 1px solid black;">x</th>
<th style="border: 1px solid black;">Action</th>
<th style="border: 1px solid black;">Updated X</th>
<th style="border: 1px solid black;">Updated x</th>
</tr>
<tr>
<td style="border: 1px solid black;">0</td>
Expand Down Expand Up @@ -99,7 +99,7 @@ tags:
<p><strong class="example">Example 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">strength = [2,5,4], K = 2</span></p>
<p><strong>Input:</strong> <span class="example-io">strength = [2,5,4], k = 2</span></p>

<p><strong>Output:</strong> <span class="example-io">5</span></p>

Expand All @@ -110,9 +110,9 @@ tags:
<tr>
<th style="border: 1px solid black;">Time</th>
<th style="border: 1px solid black;">Energy</th>
<th style="border: 1px solid black;">X</th>
<th style="border: 1px solid black;">x</th>
<th style="border: 1px solid black;">Action</th>
<th style="border: 1px solid black;">Updated X</th>
<th style="border: 1px solid black;">Updated x</th>
</tr>
<tr>
<td style="border: 1px solid black;">0</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3385.Minimum%20Time%20to%20Break%20Locks%20II/README.md
tags:
- 深度优先搜索
- 图
- 数组
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3385.Minimum%20Time%20to%20Break%20Locks%20II/README_EN.md
tags:
- Depth-First Search
- Graph
- Array
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: 简单
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3386.Button%20with%20Longest%20Push%20Time/README.md
tags:
- 数组
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3386.Button%20with%20Longest%20Push%20Time/README_EN.md
tags:
- Array
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3387.Maximize%20Amount%20After%20Two%20Days%20of%20Conversions/README.md
tags:
- 深度优先搜索
- 广度优先搜索
- 图
- 数组
- 字符串
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3387.Maximize%20Amount%20After%20Two%20Days%20of%20Conversions/README_EN.md
tags:
- Depth-First Search
- Breadth-First Search
- Graph
- Array
- String
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3388.Count%20Beautiful%20Splits%20in%20an%20Array/README.md
tags:
- 数组
- 动态规划
---

<!-- problem:start -->
Expand All @@ -19,8 +22,8 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3388.Co
<p>如果数组&nbsp;<code>nums</code>&nbsp;的一个分割满足以下条件,我们称它是一个 <strong>美丽</strong>&nbsp;分割:</p>

<ol>
<li>数组&nbsp;<code>nums</code>&nbsp;分为三段 <strong>非空子数组</strong>:<code>nums1</code>&nbsp;,<code>nums2</code>&nbsp;和&nbsp;<code>nums3</code>&nbsp;,三个数组&nbsp;<code>nums1</code>&nbsp;,<code>nums2</code>&nbsp;和&nbsp;<code>nums3</code>&nbsp;按顺序连接可以得到 <code>nums</code>&nbsp;。</li>
<li>子数组&nbsp;<code>nums1</code>&nbsp;是子数组&nbsp;<code>nums2</code>&nbsp;的前缀&nbsp;<strong>或者</strong>&nbsp;<code>nums2</code>&nbsp;是&nbsp;<code>nums3</code>&nbsp;的前缀。</li>
<li>数组&nbsp;<code>nums</code>&nbsp;分为三段 <span data-keyword="subarray-nonempty">非空子数组</span>:<code>nums1</code>&nbsp;,<code>nums2</code>&nbsp;和&nbsp;<code>nums3</code>&nbsp;,三个数组&nbsp;<code>nums1</code>&nbsp;,<code>nums2</code>&nbsp;和&nbsp;<code>nums3</code>&nbsp;按顺序连接可以得到 <code>nums</code>&nbsp;。</li>
<li>子数组&nbsp;<code>nums1</code>&nbsp;是子数组&nbsp;<code>nums2</code>&nbsp;的 <span data-keyword="array-prefix">前缀</span> <strong>或者</strong>&nbsp;<code>nums2</code>&nbsp;是&nbsp;<code>nums3</code>&nbsp;的 <span data-keyword="array-prefix">前缀</span>。</li>
</ol>

<p>请你返回满足以上条件的分割 <strong>数目</strong>&nbsp;。</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
- 哈希表
- 字符串
- 动态规划
- 计数
- 枚举
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
---

<!-- problem:start -->
Expand Down
Loading
Loading