Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

feat: update lc problems #3851

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 10, 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
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/3375.Minimum%20Operations%20to%20Make%20Array%20Values%20Equal%20to%20K/README.md
tags:
- 数组
- 哈希表
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3375.Minimum%20Operations%20to%20Make%20Array%20Values%20Equal%20to%20K/README_EN.md
tags:
- Array
- Hash Table
---

<!-- 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/3376.Minimum%20Time%20to%20Break%20Locks%20I/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/3376.Minimum%20Time%20to%20Break%20Locks%20I/README_EN.md
tags:
- Bit Manipulation
- Array
- Dynamic Programming
- Backtracking
- Bitmask
---

<!-- 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/3377.Digit%20Operations%20to%20Make%20Two%20Integers%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: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3377.Digit%20Operations%20to%20Make%20Two%20Integers%20Equal/README_EN.md
tags:
- Graph
- Math
- Number Theory
- Shortest Path
- Heap (Priority Queue)
---

<!-- 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/3378.Count%20Connected%20Components%20in%20LCM%20Graph/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/3378.Count%20Connected%20Components%20in%20LCM%20Graph/README_EN.md
tags:
- Union Find
- Array
- Hash Table
- Math
- Number Theory
---

<!-- problem:start -->
Expand Down
3 changes: 3 additions & 0 deletions solution/3300-3399/3379.Transformed Array/README.md
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/3379.Transformed%20Array/README.md
tags:
- 数组
- 模拟
---

<!-- problem:start -->
Expand Down
3 changes: 3 additions & 0 deletions solution/3300-3399/3379.Transformed Array/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
comments: true
difficulty: Easy
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3379.Transformed%20Array/README_EN.md
tags:
- Array
- Simulation
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
comments: true
difficulty: 中等
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3380.Maximum%20Area%20Rectangle%20With%20Point%20Constraints%20I/README.md
tags:
- 树状数组
- 线段树
- 几何
- 数组
- 数学
- 枚举
- 排序
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3380.Maximum%20Area%20Rectangle%20With%20Point%20Constraints%20I/README_EN.md
tags:
- Binary Indexed Tree
- Segment Tree
- Geometry
- Array
- Math
- Enumeration
- Sorting
---

<!-- problem:start -->
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/3381.Maximum%20Subarray%20Sum%20With%20Length%20Divisible%20by%20K/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: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3381.Maximum%20Subarray%20Sum%20With%20Length%20Divisible%20by%20K/README_EN.md
tags:
- Array
- Hash Table
- Prefix Sum
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3382.Maximum%20Area%20Rectangle%20With%20Point%20Constraints%20II/README.md
tags:
- 树状数组
- 线段树
- 几何
- 数组
- 数学
- 排序
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3382.Maximum%20Area%20Rectangle%20With%20Point%20Constraints%20II/README_EN.md
tags:
- Binary Indexed Tree
- Segment Tree
- Geometry
- Array
- Math
- Sorting
---

<!-- problem:start -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,67 +2,75 @@
comments: true
difficulty: 困难
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3383.Minimum%20Runes%20to%20Add%20to%20Cast%20Spell/README.md
tags:
- 深度优先搜索
- 广度优先搜索
- 图
- 拓扑排序
- 数组
---

<!-- problem:start -->

# [3383. Minimum Runes to Add to Cast Spell 🔒](https://leetcode.cn/problems/minimum-runes-to-add-to-cast-spell)
# [3383. 施法所需最低符文数量 🔒](https://leetcode.cn/problems/minimum-runes-to-add-to-cast-spell)

[English Version](/solution/3300-3399/3383.Minimum%20Runes%20to%20Add%20to%20Cast%20Spell/README_EN.md)

## 题目描述

<!-- description:start -->

<p>Alice has just graduated from wizard school, and wishes to cast a magic spell to celebrate. The magic spell contains certain <strong>focus points</strong> where magic needs to be concentrated, and some of these focus points contain <strong>magic crystals</strong> which serve as the spell&#39;s energy source. Focus points can be linked through <strong>directed runes</strong>, which channel magic flow from one focus point to another.</p>
<p>Alice 刚刚从巫师学校毕业,并且希望施展一个魔法咒语来庆祝。魔法咒语包含某些需要集中魔力的焦点,其中一些焦点含有作为咒语能量源的魔法水晶。焦点可以通过 <strong>有向符文</strong>&nbsp;进行连接,这些符文将魔力流从一个焦点传输到另一个焦点。</p>

<p>You are given a integer <code>n</code> denoting the <em>number</em> of focus points and an array of integers <code>crystals</code> where <code>crystals[i]</code> indicates a focus point which holds a magic crystal. You are also given two integer arrays <code>flowFrom</code> and <code>flowTo</code>, which represent the existing <strong>directed runes</strong>. The <code>i<sup>th</sup></code> rune allows magic to freely flow from focus point <code>flowFrom[i]</code> to focus point <code>flowTo[i]</code>.</p>
<p>给定一个整数&nbsp;<code>n</code>&nbsp;表示焦点的数量,以及一个整数数组&nbsp;<code>crystals</code>,其中&nbsp;<code>crystals[i]</code>&nbsp;表示有魔法水晶的焦点。同时给定两个整数数组&nbsp;<code>flowFrom</code> 和&nbsp;<code>flowTo</code>,表示存在的 <strong>有向符文</strong>。第&nbsp;<code>i<sup>th</sup></code>&nbsp;个符文允许魔力流从焦点&nbsp;<code>flowFrom[i]</code>&nbsp;传输到焦点&nbsp;<code>flowTo[i]</code></p>

<p>You need to find the number of directed runes Alice must add to her spell, such that <em>each</em> focus point either:</p>
<p>你需要找到 Alice 必须添加到她的咒语中的定向符文数量,使得每个焦点要么:</p>

<ul>
<li><strong>Contains</strong> a magic crystal.</li>
<li><strong>Receives</strong> magic flow <em>from</em> another focus point.</li>
<li><strong>包含</strong>&nbsp;一个魔法水晶。</li>
<li>从其它焦点&nbsp;<strong>接收</strong>&nbsp;魔力流。</li>
</ul>

<p>Return the <strong>minimum</strong> number of directed runes that she should add.</p>
<p>返回她所需要添加的 <strong>最少</strong>&nbsp;有向符文数量。</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<p><strong class="example">示例 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">n = 6, crystals = [0], flowFrom = [0,1,2,3], flowTo = [1,2,3,0]</span></p>
<p><strong>输入:</strong><span class="example-io">n = 6, crystals = [0], flowFrom = [0,1,2,3], flowTo = [1,2,3,0]</span></p>

<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><span class="example-io"><b>输出:</b>2</span></p>

<p><strong>Explanation:</strong>&nbsp;</p>
<p><b>解释:</b></p>

<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/3300-3399/3383.Minimum%20Runes%20to%20Add%20to%20Cast%20Spell/images/runesexample0.png" style="width: 250px; height: 252px;" /></p>

<p>Add two directed runes:</p>
<p>添加两个有向符文:</p>

<ul>
<li>From focus point&nbsp;0 to focus point&nbsp;4.</li>
<li>From focus point 0 to focus point 5.</li>
<li>从焦点 0 到焦点 4。</li>
<li>从焦点 0 到焦点 5。</li>
</ul>
</div>

<p><strong class="example">Example 2:</strong></p>
<p><strong class="example">示例 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">n = 7, crystals = [3,5], flowFrom = [0,1,2,3,5], flowTo = [1,2,0,4,6]</span></p>
<p><span class="example-io"><b>输入:</b>n = 7, crystals = [3,5], flowFrom = [0,1,2,3,5], flowTo = [1,2,0,4,6]</span></p>

<p><strong>Output:</strong> <span class="example-io">1</span></p>
<p><span class="example-io"><b>输出:</b>1</span></p>

<p><strong>Explanation:</strong>&nbsp;</p>
<p><b>解释:</b></p>

<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/3300-3399/3383.Minimum%20Runes%20to%20Add%20to%20Cast%20Spell/images/runesexample1.png" style="width: 250px; height: 250px;" /></p>

<p>Add a directed rune from focus point 4 to focus point 2.</p>
<p>添加从焦点 4 到焦点 2 的有向符文。</p>
</div>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

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

<ul>
<li><code>2 &lt;= n &lt;= 10<sup>5</sup></code></li>
Expand All @@ -71,7 +79,7 @@ edit_url: https://github.com/doocs/leetcode/edit/main/solution/3300-3399/3383.Mi
<li><code>1 &lt;= flowFrom.length == flowTo.length &lt;= min(2 * 10<sup>5</sup>, (n * (n - 1)) / 2)</code></li>
<li><code>0 &lt;= flowFrom[i], flowTo[i] &lt;= n - 1</code></li>
<li><code>flowFrom[i] != flowTo[i]</code></li>
<li>All pre-existing directed runes are <strong>distinct</strong>.</li>
<li>所有的有向符文 <strong>互不相同</strong></li>
</ul>

<!-- description:end -->
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/3383.Minimum%20Runes%20to%20Add%20to%20Cast%20Spell/README_EN.md
tags:
- Depth-First Search
- Breadth-First Search
- Graph
- Topological Sort
- Array
---

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