1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-07 08:21:41 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2022-05-02 23:44:12 +08:00
parent 7ea03594b3
commit 2a71c78585
4790 changed files with 11696 additions and 10944 deletions

View File

@@ -12,7 +12,7 @@
"translatedContent": "<p>给你一个数组 <code>orders</code>,表示客户在餐厅中完成的订单,确切地说, <code>orders[i]=[customerName<sub>i</sub>,tableNumber<sub>i</sub>,foodItem<sub>i</sub>]</code> ,其中 <code>customerName<sub>i</sub></code> 是客户的姓名,<code>tableNumber<sub>i</sub></code> 是客户所在餐桌的桌号,而 <code>foodItem<sub>i</sub></code> 是客户点的餐品名称。</p>\n\n<p>请你返回该餐厅的 <strong>点菜展示表</strong><em> 。</em>在这张表中,表中第一行为标题,其第一列为餐桌桌号 &ldquo;Table&rdquo; ,后面每一列都是按字母顺序排列的餐品名称。接下来每一行中的项则表示每张餐桌订购的相应餐品数量,第一列应当填对应的桌号,后面依次填写下单的餐品数量。</p>\n\n<p>注意:客户姓名不是点菜展示表的一部分。此外,表中的数据行应该按餐桌桌号升序排列。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre><strong>输入:</strong>orders = [[&quot;David&quot;,&quot;3&quot;,&quot;Ceviche&quot;],[&quot;Corina&quot;,&quot;10&quot;,&quot;Beef Burrito&quot;],[&quot;David&quot;,&quot;3&quot;,&quot;Fried Chicken&quot;],[&quot;Carla&quot;,&quot;5&quot;,&quot;Water&quot;],[&quot;Carla&quot;,&quot;5&quot;,&quot;Ceviche&quot;],[&quot;Rous&quot;,&quot;3&quot;,&quot;Ceviche&quot;]]\n<strong>输出:</strong>[[&quot;Table&quot;,&quot;Beef Burrito&quot;,&quot;Ceviche&quot;,&quot;Fried Chicken&quot;,&quot;Water&quot;],[&quot;3&quot;,&quot;0&quot;,&quot;2&quot;,&quot;1&quot;,&quot;0&quot;],[&quot;5&quot;,&quot;0&quot;,&quot;1&quot;,&quot;0&quot;,&quot;1&quot;],[&quot;10&quot;,&quot;1&quot;,&quot;0&quot;,&quot;0&quot;,&quot;0&quot;]] \n<strong>解释:\n</strong>点菜展示表如下所示:\n<strong>Table,Beef Burrito,Ceviche,Fried Chicken,Water</strong>\n3 ,0 ,2 ,1 ,0\n5 ,0 ,1 ,0 ,1\n10 ,1 ,0 ,0 ,0\n对于餐桌 3David 点了 &quot;Ceviche&quot; 和 &quot;Fried Chicken&quot;,而 Rous 点了 &quot;Ceviche&quot;\n而餐桌 5Carla 点了 &quot;Water&quot; 和 &quot;Ceviche&quot;\n餐桌 10Corina 点了 &quot;Beef Burrito&quot; \n</pre>\n\n<p><strong>示例 2</strong></p>\n\n<pre><strong>输入:</strong>orders = [[&quot;James&quot;,&quot;12&quot;,&quot;Fried Chicken&quot;],[&quot;Ratesh&quot;,&quot;12&quot;,&quot;Fried Chicken&quot;],[&quot;Amadeus&quot;,&quot;12&quot;,&quot;Fried Chicken&quot;],[&quot;Adam&quot;,&quot;1&quot;,&quot;Canadian Waffles&quot;],[&quot;Brianna&quot;,&quot;1&quot;,&quot;Canadian Waffles&quot;]]\n<strong>输出:</strong>[[&quot;Table&quot;,&quot;Canadian Waffles&quot;,&quot;Fried Chicken&quot;],[&quot;1&quot;,&quot;2&quot;,&quot;0&quot;],[&quot;12&quot;,&quot;0&quot;,&quot;3&quot;]] \n<strong>解释:</strong>\n对于餐桌 1Adam 和 Brianna 都点了 &quot;Canadian Waffles&quot;\n而餐桌 12James, Ratesh 和 Amadeus 都点了 &quot;Fried Chicken&quot;\n</pre>\n\n<p><strong>示例 3</strong></p>\n\n<pre><strong>输入:</strong>orders = [[&quot;Laura&quot;,&quot;2&quot;,&quot;Bean Burrito&quot;],[&quot;Jhon&quot;,&quot;2&quot;,&quot;Beef Burrito&quot;],[&quot;Melissa&quot;,&quot;2&quot;,&quot;Soda&quot;]]\n<strong>输出:</strong>[[&quot;Table&quot;,&quot;Bean Burrito&quot;,&quot;Beef Burrito&quot;,&quot;Soda&quot;],[&quot;2&quot;,&quot;1&quot;,&quot;1&quot;,&quot;1&quot;]]\n</pre>\n\n<p>&nbsp;</p>\n\n<p><strong>提示:</strong></p>\n\n<ul>\n\t<li><code>1 &lt;=&nbsp;orders.length &lt;= 5 * 10^4</code></li>\n\t<li><code>orders[i].length == 3</code></li>\n\t<li><code>1 &lt;= customerName<sub>i</sub>.length, foodItem<sub>i</sub>.length &lt;= 20</code></li>\n\t<li><code>customerName<sub>i</sub></code> 和 <code>foodItem<sub>i</sub></code> 由大小写英文字母及空格字符 <code>&#39; &#39;</code> 组成。</li>\n\t<li><code>tableNumber<sub>i</sub></code> 是 <code>1</code> 到 <code>500</code> 范围内的整数。</li>\n</ul>\n",
"isPaidOnly": false,
"difficulty": "Medium",
"likes": 80,
"likes": 82,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
@@ -161,7 +161,7 @@
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"26.9K\", \"totalSubmission\": \"36.8K\", \"totalAcceptedRaw\": 26882, \"totalSubmissionRaw\": 36779, \"acRate\": \"73.1%\"}",
"stats": "{\"totalAccepted\": \"27K\", \"totalSubmission\": \"37K\", \"totalAcceptedRaw\": 27025, \"totalSubmissionRaw\": 36980, \"acRate\": \"73.1%\"}",
"hints": [
"Keep the frequency of all pairs (tableNumber, foodItem) using a hashmap.",
"Sort rows by tableNumber and columns by foodItem, then process the resulted table."