mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-21 04:56:46 +08:00
92 lines
10 KiB
JSON
92 lines
10 KiB
JSON
{
|
||
"data": {
|
||
"question": {
|
||
"questionId": "3782",
|
||
"questionFrontendId": "3436",
|
||
"categoryTitle": "Database",
|
||
"boundTopicId": 3059804,
|
||
"title": "Find Valid Emails",
|
||
"titleSlug": "find-valid-emails",
|
||
"content": "<p>Table: <code>Users</code></p>\n\n<pre>\n+-----------------+---------+\n| Column Name | Type |\n+-----------------+---------+\n| user_id | int |\n| email | varchar |\n+-----------------+---------+\n(user_id) is the unique key for this table.\nEach row contains a user's unique ID and email address.\n</pre>\n\n<p>Write a solution to find all the <strong>valid email addresses</strong>. A valid email address meets the following criteria:</p>\n\n<ul>\n\t<li>It contains exactly one <code>@</code> symbol.</li>\n\t<li>It ends with <code>.com</code>.</li>\n\t<li>The part before the <code>@</code> symbol contains only <strong>alphanumeric</strong> characters and <strong>underscores</strong>.</li>\n\t<li>The part after the <code>@</code> symbol and before <code>.com</code> contains a domain name <strong>that contains only letters</strong>.</li>\n</ul>\n\n<p>Return<em> the result table ordered by</em> <code>user_id</code> <em>in</em> <strong>ascending </strong><em>order</em>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>Input:</strong></p>\n\n<p>Users table:</p>\n\n<pre class=\"example-io\">\n+---------+---------------------+\n| user_id | email |\n+---------+---------------------+\n| 1 | alice@example.com |\n| 2 | bob_at_example.com |\n| 3 | charlie@example.net |\n| 4 | david@domain.com |\n| 5 | eve@invalid |\n+---------+---------------------+\n</pre>\n\n<p><strong>Output:</strong></p>\n\n<pre class=\"example-io\">\n+---------+-------------------+\n| user_id | email |\n+---------+-------------------+\n| 1 | alice@example.com |\n| 4 | david@domain.com |\n+---------+-------------------+\n</pre>\n\n<p><strong>Explanation:</strong></p>\n\n<ul>\n\t<li><strong>alice@example.com</strong> is valid because it contains one <code>@</code>, alice is alphanumeric, and example.com starts with a letter and ends with .com.</li>\n\t<li><strong>bob_at_example.com</strong> is invalid because it contains an underscore instead of an <code>@</code>.</li>\n\t<li><strong>charlie@example.net</strong> is invalid because the domain does not end with <code>.com</code>.</li>\n\t<li><strong>david@domain.com</strong> is valid because it meets all criteria.</li>\n\t<li><strong>eve@invalid</strong> is invalid because the domain does not end with <code>.com</code>.</li>\n</ul>\n\n<p>Result table is ordered by user_id in ascending order.</p>\n</div>\n",
|
||
"translatedTitle": "查找合法邮箱",
|
||
"translatedContent": "<p>表:<code>Users</code></p>\n\n<pre>\n+-----------------+---------+\n| Column Name | Type |\n+-----------------+---------+\n| user_id | int |\n| email | varchar |\n+-----------------+---------+\n(user_id) 是这张表的唯一主键。\n每一行包含用户的唯一 ID 和邮箱地址。\n</pre>\n\n<p>编写一个解决方案来查找所有 <b>合法邮箱地址</b>。一个合法的邮箱地址符合下述条件:</p>\n\n<ul>\n\t<li>只包含一个 <code>@</code> 符号。</li>\n\t<li>以 <code>.com</code> 结尾。</li>\n\t<li><code>@</code> 符号前面的部分只包含 <strong>字母数字</strong> 字符和 <strong>下划线</strong>。</li>\n\t<li><code>@</code> 符号后面与 <code>.com</code> 前面的部分 包含 <strong>只有字母 </strong>的域名。</li>\n</ul>\n\n<p>返回结果表以 <code>user_id</code> <strong>升序</strong> 排序。</p>\n\n<p> </p>\n\n<p><strong class=\"example\">示例:</strong></p>\n\n<div class=\"example-block\">\n<p><strong>输入:</strong></p>\n\n<p>Users 表:</p>\n\n<pre class=\"example-io\">\n+---------+---------------------+\n| user_id | email |\n+---------+---------------------+\n| 1 | alice@example.com |\n| 2 | bob_at_example.com |\n| 3 | charlie@example.net |\n| 4 | david@domain.com |\n| 5 | eve@invalid |\n+---------+---------------------+\n</pre>\n\n<p><strong>输出:</strong></p>\n\n<pre class=\"example-io\">\n+---------+-------------------+\n| user_id | email |\n+---------+-------------------+\n| 1 | alice@example.com |\n| 4 | david@domain.com |\n+---------+-------------------+\n</pre>\n\n<p><strong>解释:</strong></p>\n\n<ul>\n\t<li><strong>alice@example.com</strong> 是合法的因为它包含一个 <code>@</code>,alice 是只有字母数字的,并且 example.com 以字母开始并以 .com 结束。</li>\n\t<li><strong>bob_at_example.com</strong> 是不合法的因为它包含下划线但没有 <code>@</code>。</li>\n\t<li><strong>charlie@example.net</strong> 是不合法的因为域名没有以 <code>.com</code> 结尾。</li>\n\t<li><strong>david@domain.com</strong> 是合法的因为它满足所有条件。</li>\n\t<li><strong>eve@invalid</strong> 是不合法的因为域名没有以 <code>.com</code> 结尾。</li>\n</ul>\n\n<p>结果表以 user_id 升序排序。</p>\n</div>\n",
|
||
"isPaidOnly": false,
|
||
"difficulty": "Easy",
|
||
"likes": 2,
|
||
"dislikes": 0,
|
||
"isLiked": null,
|
||
"similarQuestions": "[]",
|
||
"contributors": [],
|
||
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python3\": false, \"python\": false, \"javascript\": false, \"typescript\": false, \"csharp\": false, \"c\": false, \"golang\": false, \"kotlin\": false, \"swift\": false, \"rust\": false, \"ruby\": false, \"php\": false, \"dart\": false, \"scala\": false, \"elixir\": false, \"erlang\": false, \"racket\": false, \"cangjie\": false, \"bash\": false, \"html\": false, \"pythonml\": false, \"react\": false, \"vanillajs\": false, \"mysql\": false, \"mssql\": false, \"postgresql\": false, \"oraclesql\": false, \"pythondata\": 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": "PostgreSQL",
|
||
"langSlug": "postgresql",
|
||
"code": "-- Write your PostgreSQL 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_valid_emails(users: pd.DataFrame) -> pd.DataFrame:\n ",
|
||
"__typename": "CodeSnippetNode"
|
||
}
|
||
],
|
||
"stats": "{\"totalAccepted\": \"3.1K\", \"totalSubmission\": \"5.4K\", \"totalAcceptedRaw\": 3133, \"totalSubmissionRaw\": 5428, \"acRate\": \"57.7%\"}",
|
||
"hints": [],
|
||
"solution": null,
|
||
"status": null,
|
||
"sampleTestCase": "{\"headers\":{\"Users\":[\"user_id\",\"email\"]},\"rows\":{\"Users\":[[1,\"alice@example.com\"],[2,\"bob_at_example.com\"],[3,\"charlie@example.net\"],[4,\"david@domain.com\"],[5,\"eve@invalid\"]]}}",
|
||
"metaData": "{\"mysql\":[\"CREATE TABLE If not Exists Users (\\n user_id INT,\\n email VARCHAR(255)\\n)\"],\"mssql\":[\"CREATE TABLE Users (\\n user_id INT,\\n email VARCHAR(255)\\n)\"],\"oraclesql\":[\"CREATE TABLE Users (\\n user_id NUMBER,\\n email VARCHAR2(255)\\n)\"],\"database\":true,\"name\":\"find_valid_emails\",\"postgresql\":[\"CREATE TABLE IF NOT EXISTS users (\\n user_id INT,\\n email VARCHAR(255)\\n);\\n\"],\"pythondata\":[\"Users = pd.DataFrame(columns=[\\\"user_id\\\", \\\"email\\\"]).astype({\\\"user_id\\\": \\\"int32\\\", \\\"email\\\": \\\"string\\\"})\\n\"],\"database_schema\":{\"Users\":{\"user_id\":\"INT\",\"email\":\"VARCHAR(255)\"}}}",
|
||
"judgerAvailable": true,
|
||
"judgeType": "large",
|
||
"mysqlSchemas": [
|
||
"CREATE TABLE If not Exists Users (\n user_id INT,\n email VARCHAR(255)\n)",
|
||
"Truncate table Users",
|
||
"insert into Users (user_id, email) values ('1', 'alice@example.com')",
|
||
"insert into Users (user_id, email) values ('2', 'bob_at_example.com')",
|
||
"insert into Users (user_id, email) values ('3', 'charlie@example.net')",
|
||
"insert into Users (user_id, email) values ('4', 'david@domain.com')",
|
||
"insert into Users (user_id, email) values ('5', 'eve@invalid')"
|
||
],
|
||
"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.2.2 and NumPy 1.26.4<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
|
||
"book": null,
|
||
"isSubscribed": false,
|
||
"isDailyQuestion": false,
|
||
"dailyRecordStatus": null,
|
||
"editorType": "CKEDITOR",
|
||
"ugcQuestionId": null,
|
||
"style": "LEETCODE",
|
||
"exampleTestcases": "{\"headers\":{\"Users\":[\"user_id\",\"email\"]},\"rows\":{\"Users\":[[1,\"alice@example.com\"],[2,\"bob_at_example.com\"],[3,\"charlie@example.net\"],[4,\"david@domain.com\"],[5,\"eve@invalid\"]]}}",
|
||
"__typename": "QuestionNode"
|
||
}
|
||
}
|
||
} |