1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-26 18:20:27 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/originData/recyclable-and-low-fat-products.json
2023-12-09 19:57:46 +08:00

92 lines
9.0 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"data": {
"question": {
"questionId": "1908",
"questionFrontendId": "1757",
"categoryTitle": "Database",
"boundTopicId": 602152,
"title": "Recyclable and Low Fat Products",
"titleSlug": "recyclable-and-low-fat-products",
"content": "<p>Table: <code>Products</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| product_id | int |\n| low_fats | enum |\n| recyclable | enum |\n+-------------+---------+\nproduct_id is the primary key (column with unique values) for this table.\nlow_fats is an ENUM (category) of type (&#39;Y&#39;, &#39;N&#39;) where &#39;Y&#39; means this product is low fat and &#39;N&#39; means it is not.\nrecyclable is an ENUM (category) of types (&#39;Y&#39;, &#39;N&#39;) where &#39;Y&#39; means this product is recyclable and &#39;N&#39; means it is not.</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to find the ids of products that are both low fat and recyclable.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nProducts table:\n+-------------+----------+------------+\n| product_id | low_fats | recyclable |\n+-------------+----------+------------+\n| 0 | Y | N |\n| 1 | Y | Y |\n| 2 | N | Y |\n| 3 | Y | Y |\n| 4 | N | N |\n+-------------+----------+------------+\n<strong>Output:</strong> \n+-------------+\n| product_id |\n+-------------+\n| 1 |\n| 3 |\n+-------------+\n<strong>Explanation:</strong> Only products 1 and 3 are both low fat and recyclable.\n</pre>\n",
"translatedTitle": "可回收且低脂的产品",
"translatedContent": "<p>表:<code>Products</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| product_id | int |\n| low_fats | enum |\n| recyclable | enum |\n+-------------+---------+\n<code>product_id</code> 是该表的主键(具有唯一值的列)。\nlow_fats 是枚举类型,取值为以下两种 ('Y', 'N'),其中 'Y' 表示该产品是低脂产品,'N' 表示不是低脂产品。\nrecyclable 是枚举类型,取值为以下两种 ('Y', 'N'),其中 'Y' 表示该产品可回收,而 'N' 表示不可回收。</pre>\n\n<p>&nbsp;</p>\n\n<p>编写解决方案找出既是低脂又是可回收的产品编号。</p>\n\n<p>返回结果 <strong>无顺序要求</strong> 。</p>\n\n<p>返回结果格式如下例所示:</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1</strong></p>\n\n<pre>\n<strong>输入:</strong>\nProducts 表:\n+-------------+----------+------------+\n| product_id | low_fats | recyclable |\n+-------------+----------+------------+\n| 0 | Y | N |\n| 1 | Y | Y |\n| 2 | N | Y |\n| 3 | Y | Y |\n| 4 | N | N |\n+-------------+----------+------------+\n<strong>输出:</strong>\n+-------------+\n| product_id |\n+-------------+\n| 1 |\n| 3 |\n+-------------+\n<strong>解释:</strong>\n只有产品 id 为 1 和 3 的产品,既是低脂又是可回收的产品。\n</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 126,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": "数据库",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef find_products(products: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"157.3K\", \"totalSubmission\": \"182.6K\", \"totalAcceptedRaw\": 157262, \"totalSubmissionRaw\": 182616, \"acRate\": \"86.1%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Products\":[\"product_id\",\"low_fats\",\"recyclable\"]},\"rows\":{\"Products\":[[\"0\",\"Y\",\"N\"],[\"1\",\"Y\",\"Y\"],[\"2\",\"N\",\"Y\"],[\"3\",\"Y\",\"Y\"],[\"4\",\"N\",\"N\"]]}}",
"metaData": "{\"mysql\":[\"Create table If Not Exists Products (product_id int, low_fats ENUM('Y', 'N'), recyclable ENUM('Y','N'))\"],\"mssql\":[\"Create table Products (product_id int, low_fats varchar(1) not null check(low_fats in ('Y', 'N')), recyclable varchar(1) not null check(recyclable in ('Y', 'N')))\"],\"oraclesql\":[\"Create table Products (product_id int, low_fats varchar(1) not null check(low_fats in ('Y', 'N')), recyclable varchar(1) not null check(recyclable in ('Y', 'N')))\"],\"database\":true,\"name\":\"find_products\",\"pythondata\":[\"Products = pd.DataFrame([], columns=['product_id', 'low_fats', 'recyclable']).astype({'product_id':'int64', 'low_fats':'category', 'recyclable':'category'})\"],\"postgresql\":[\"Create table If Not Exists Products (product_id int, low_fats VARCHAR(30) CHECK (low_fats IN ('Y', 'N')), recyclable VARCHAR(30) CHECK (recyclable IN ('Y','N')))\\n\"],\"database_schema\":{\"Products\":{\"product_id\":\"INT\",\"low_fats\":\"ENUM('Y', 'N')\",\"recyclable\":\"ENUM('Y', 'N')\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Products (product_id int, low_fats ENUM('Y', 'N'), recyclable ENUM('Y','N'))",
"Truncate table Products",
"insert into Products (product_id, low_fats, recyclable) values ('0', 'Y', 'N')",
"insert into Products (product_id, low_fats, recyclable) values ('1', 'Y', 'Y')",
"insert into Products (product_id, low_fats, recyclable) values ('2', 'N', 'Y')",
"insert into Products (product_id, low_fats, recyclable) values ('3', 'Y', 'Y')",
"insert into Products (product_id, low_fats, recyclable) values ('4', 'N', 'N')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"Products\":[\"product_id\",\"low_fats\",\"recyclable\"]},\"rows\":{\"Products\":[[\"0\",\"Y\",\"N\"],[\"1\",\"Y\",\"Y\"],[\"2\",\"N\",\"Y\"],[\"3\",\"Y\",\"Y\"],[\"4\",\"N\",\"N\"]]}}",
"__typename": "QuestionNode"
}
}
}