Skip to content

Commit

Permalink
feat: add solutions to lc problem: No.3294
Browse files Browse the repository at this point in the history
No.3294.Convert Doubly Linked List to Array II
  • Loading branch information
yanglbme committed Sep 19, 2024
1 parent abe25e2 commit 5bd96cb
Show file tree
Hide file tree
Showing 43 changed files with 622 additions and 23 deletions.
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/3200-3299/3264.Final%20Array%20State%20After%20K%20Multiplication%20Operations%20I/README.md
rating: 1177
source: 第 412 场周赛 Q1
tags:
- 数组
- 数学
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/3200-3299/3264.Final%20Array%20State%20After%20K%20Multiplication%20Operations%20I/README_EN.md
rating: 1177
source: Weekly Contest 412 Q1
tags:
- Array
- Math
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3265.Count Almost Equal Pairs I/README.md
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/3200-3299/3265.Count%20Almost%20Equal%20Pairs%20I/README.md
rating: 1661
source: 第 412 场周赛 Q2
tags:
- 数组
- 哈希表
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3265.Count%20Almost%20Equal%20Pairs%20I/README_EN.md
rating: 1661
source: Weekly Contest 412 Q2
tags:
- Array
- Hash Table
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/3200-3299/3266.Final%20Array%20State%20After%20K%20Multiplication%20Operations%20II/README.md
rating: 2508
source: 第 412 场周赛 Q3
tags:
- 数组
- 模拟
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3266.Final%20Array%20State%20After%20K%20Multiplication%20Operations%20II/README_EN.md
rating: 2508
source: Weekly Contest 412 Q3
tags:
- Array
- Simulation
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3267.Count Almost Equal Pairs II/README.md
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/3200-3299/3267.Count%20Almost%20Equal%20Pairs%20II/README.md
rating: 2545
source: 第 412 场周赛 Q4
tags:
- 数组
- 哈希表
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3267.Count%20Almost%20Equal%20Pairs%20II/README_EN.md
rating: 2545
source: Weekly Contest 412 Q4
tags:
- Array
- Hash Table
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3270.Find the Key of the Numbers/README.md
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/3200-3299/3270.Find%20the%20Key%20of%20the%20Numbers/README.md
rating: 1205
source: 第 138 场双周赛 Q1
tags:
- 数学
---
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/3200-3299/3270.Find%20the%20Key%20of%20the%20Numbers/README_EN.md
rating: 1205
source: Biweekly Contest 138 Q1
tags:
- Math
---
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3271.Hash Divided String/README.md
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/3200-3299/3271.Hash%20Divided%20String/README.md
rating: 1292
source: 第 138 场双周赛 Q2
tags:
- 字符串
- 模拟
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3271.Hash Divided String/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3271.Hash%20Divided%20String/README_EN.md
rating: 1292
source: Biweekly Contest 138 Q2
tags:
- String
- Simulation
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/3200-3299/3272.Find%20the%20Count%20of%20Good%20Integers/README.md
rating: 2382
source: 第 138 场双周赛 Q3
tags:
- 哈希表
- 数学
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3272.Find%20the%20Count%20of%20Good%20Integers/README_EN.md
rating: 2382
source: Biweekly Contest 138 Q3
tags:
- Hash Table
- Math
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/3200-3299/3273.Minimum%20Amount%20of%20Damage%20Dealt%20to%20Bob/README.md
rating: 2012
source: 第 138 场双周赛 Q4
tags:
- 贪心
- 数组
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3273.Minimum%20Amount%20of%20Damage%20Dealt%20to%20Bob/README_EN.md
rating: 2012
source: Biweekly Contest 138 Q4
tags:
- Greedy
- Array
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/3200-3299/3274.Check%20if%20Two%20Chessboard%20Squares%20Have%20the%20Same%20Color/README.md
rating: 1162
source: 第 413 场周赛 Q1
tags:
- 数学
- 字符串
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/3200-3299/3274.Check%20if%20Two%20Chessboard%20Squares%20Have%20the%20Same%20Color/README_EN.md
rating: 1162
source: Weekly Contest 413 Q1
tags:
- Math
- String
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/3200-3299/3275.K-th%20Nearest%20Obstacle%20Queries/README.md
rating: 1419
source: 第 413 场周赛 Q2
tags:
- 数组
- 堆(优先队列)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3275.K-th%20Nearest%20Obstacle%20Queries/README_EN.md
rating: 1419
source: Weekly Contest 413 Q2
tags:
- Array
- Heap (Priority Queue)
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/3200-3299/3276.Select%20Cells%20in%20Grid%20With%20Maximum%20Score/README.md
rating: 2402
source: 第 413 场周赛 Q3
tags:
- 位运算
- 数组
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3276.Select%20Cells%20in%20Grid%20With%20Maximum%20Score/README_EN.md
rating: 2402
source: Weekly Contest 413 Q3
tags:
- Bit Manipulation
- Array
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/3200-3299/3277.Maximum%20XOR%20Score%20Subarray%20Queries/README.md
rating: 2692
source: 第 413 场周赛 Q4
tags:
- 数组
- 动态规划
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3277.Maximum%20XOR%20Score%20Subarray%20Queries/README_EN.md
rating: 2692
source: Weekly Contest 413 Q4
tags:
- Array
- Dynamic Programming
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3280.Convert Date to Binary/README.md
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/3200-3299/3280.Convert%20Date%20to%20Binary/README.md
rating: 1205
source: 第 414 场周赛 Q1
tags:
- 数学
- 字符串
Expand Down
2 changes: 2 additions & 0 deletions solution/3200-3299/3280.Convert Date to Binary/README_EN.md
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/3200-3299/3280.Convert%20Date%20to%20Binary/README_EN.md
rating: 1205
source: Weekly Contest 414 Q1
tags:
- Math
- String
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/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README.md
rating: 1768
source: 第 414 场周赛 Q2
tags:
- 贪心
- 数组
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README_EN.md
rating: 1768
source: Weekly Contest 414 Q2
tags:
- Greedy
- Array
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/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README.md
rating: 1771
source: 第 414 场周赛 Q3
tags:
- 贪心
- 数组
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Medium
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README_EN.md
rating: 1771
source: Weekly Contest 414 Q3
tags:
- Greedy
- Array
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/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README.md
rating: 2473
source: 第 414 场周赛 Q4
tags:
- 位运算
- 广度优先搜索
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
comments: true
difficulty: Hard
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README_EN.md
rating: 2473
source: Weekly Contest 414 Q4
tags:
- Bit Manipulation
- Breadth-First Search
Expand Down
43 changes: 22 additions & 21 deletions solution/3200-3299/3293.Calculate Product Final Price/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ tags:

<!-- problem:start -->

# [3293. Calculate Product Final Price 🔒](https://leetcode.cn/problems/calculate-product-final-price)
# [3293. 计算产品最终价格 🔒](https://leetcode.cn/problems/calculate-product-final-price)

[English Version](/solution/3200-3299/3293.Calculate%20Product%20Final%20Price/README_EN.md)

## 题目描述

<!-- description:start -->

<p>Table: <font face="monospace"><code>Products</code></font></p>
<p>表:<font face="monospace"><code>Products</code></font></p>

<pre>
+------------+---------+
Expand All @@ -26,11 +26,11 @@ tags:
| category | varchar |
| price | decimal |
+------------+---------+
product_id is the unique key for this table.
Each row includes the product&#39;s ID, its category, and its price.
product_id 是这张表的唯一主键。
每一行包含产品的 ID,分类以及价格。
</pre>

<p>Table: <font face="monospace"><code>Discounts</code></font></p>
<p>表:<font face="monospace"><code>Discounts</code></font></p>

<pre>
+------------+---------+
Expand All @@ -39,23 +39,24 @@ Each row includes the product&#39;s ID, its category, and its price.
| category | varchar |
| discount | int |
+------------+---------+
category is the primary key for this table.
Each row contains a product category and the percentage discount applied to that category (values range from 0 to 100).
category 是这张表的主键。
每一行包含有一个产品分类和该分类的折扣百分比(值的范围从 0 到 100)。
</pre>

<p>Write a solution to find the <strong>final price</strong> of each product after applying the <strong>category discount</strong>. If a product&#39;s category has <strong>no</strong> <strong>associated</strong> <strong>discount</strong>, its price remains <strong>unchanged</strong>.</p>
<p>编写一个解决方案来找到每个产品使用 <strong>分类折扣</strong>&nbsp;后的 <strong>最终价格</strong>。如果一个产品分类 <strong>没有关联的折扣</strong>,它的价格保持 <strong>不变</strong></p>

<p>Return <em>the result table ordered by</em> <code>product_id</code><em> in <strong>ascending</strong> order.</em></p>
<p>返回结果表以&nbsp;<code>product_id</code><em> </em><strong>升序&nbsp;</strong>排序。</p>

<p>The result format is in the following example.</p>
<p>结果格式如下所示。</p>

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

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

<div class="example-block">
<p><strong>Input:</strong></p>
<p><strong>输入:</strong></p>

<p><code>Products</code> table:</p>
<p><code>Products</code> 表:</p>

<pre class="example-io">
+------------+-------------+-------+
Expand All @@ -68,7 +69,7 @@ Each row contains a product category and the percentage discount applied to that
+------------+-------------+-------+
</pre>

<p><code>Discounts</code> table:</p>
<p><code>Discounts</code> 表:</p>

<pre class="example-io">
+------------+----------+
Expand All @@ -79,7 +80,7 @@ Each row contains a product category and the percentage discount applied to that
+------------+----------+
</pre>

<p><strong>Output:</strong></p>
<p><strong>输出:</strong></p>

<pre class="example-io">
+------------+------------+-------------+
Expand All @@ -92,15 +93,15 @@ Each row contains a product category and the percentage discount applied to that
+------------+------------+-------------+
</pre>

<p><strong>Explanation:</strong></p>
<p><strong>解释:</strong></p>

<ul>
<li>For product 1, it belongs to the Electronics&nbsp;category which has a 10% discount, so the final price is 1000 - (10% of 1000) = 900.</li>
<li>For product 2, it belongs to the Clothing&nbsp;category which has a 20% discount, so the final price is 50 - (20% of 50) = 40.</li>
<li>For product 3, it belongs to the Electronics&nbsp;category and receives a 10% discount, so the final price is 1200 - (10% of 1200) = 1080.</li>
<li>For product 4, no discount is available for the Home&nbsp;category, so the final price remains 500.</li>
<li>对于产品 1,它属于电器分类,有 10% 的折扣,所以最终价格为 1000 - (10% of 1000) = 900</li>
<li>对于产品 2,它属于衣物分类,有 20% 的折扣,所以最终价格为 50 - (20% of 50) = 40</li>
<li>对于产品 3,它属于电器分类,有 10% 的折扣,所以最终价格为&nbsp;1200 - (10% of 1200) = 1080</li>
<li>对于产品 4,它属于家具分类,没有可用的折扣,所以最终价格仍是 500</li>
</ul>
Result table is ordered by product_id in ascending order.</div>
结果表以 product_id 升序排序。</div>

<!-- description:end -->

Expand Down
Loading

0 comments on commit 5bd96cb

Please sign in to comment.