1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-09-03 14:32:54 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2024-03-01 00:47:37 +08:00
parent 5028bd771c
commit e31313baa5
53 changed files with 19204 additions and 14600 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
{
"data": {
"question": {
"questionId": "3259",
"questionFrontendId": "3054",
"boundTopicId": null,
"title": "Binary Tree Nodes",
"titleSlug": "binary-tree-nodes",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 2,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Tree\":[\"N\",\"P\"]},\"rows\":{\"Tree\":[[1,2],[3,2],[6,8],[9,8],[2,5],[8,5],[5,null]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"204\", \"totalSubmission\": \"250\", \"totalAcceptedRaw\": 204, \"totalSubmissionRaw\": 250, \"acRate\": \"81.6%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Tree\":[\"N\",\"P\"]},\"rows\":{\"Tree\":[[1,2],[3,2],[6,8],[9,8],[2,5],[8,5],[5,null]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Tree (N int,P int)\"], \"mssql\": [\"Create table Tree (N int,P int)\"], \"oraclesql\": [\"Create table Tree (N int,P int)\"], \"database\": true, \"name\": \"binary_tree_nodes\", \"pythondata\": [\"Tree = pd.DataFrame([], columns=['N', 'P']).astype({'N':'Int64', 'P':'Int64'})\"], \"postgresql\": [\"Create table If Not Exists Tree (N int,P int)\\n\"], \"database_schema\": {\"Tree\": {\"N\": \"INT\", \"P\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Tree (N int,P int)",
"Truncate table Tree",
"insert into Tree (N, P) values ('1', '2')",
"insert into Tree (N, P) values ('3', '2')",
"insert into Tree (N, P) values ('6', '8')",
"insert into Tree (N, P) values ('9', '8')",
"insert into Tree (N, P) values ('2', '5')",
"insert into Tree (N, P) values ('8', '5')",
"insert into Tree (N, P) values ('5', 'None')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,58 @@
{
"data": {
"question": {
"questionId": "3369",
"questionFrontendId": "3061",
"boundTopicId": null,
"title": "Calculate Trapping Rain Water",
"titleSlug": "calculate-trapping-rain-water",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 1,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Heights\":[\"id\",\"height\"]},\"rows\":{\"Heights\":[[1,0],[2,1],[3,0],[4,2],[5,1],[6,0],[7,1],[8,3],[9,2],[10,1],[11,2],[12,1]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"39\", \"totalSubmission\": \"50\", \"totalAcceptedRaw\": 39, \"totalSubmissionRaw\": 50, \"acRate\": \"78.0%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Heights\":[\"id\",\"height\"]},\"rows\":{\"Heights\":[[1,0],[2,1],[3,0],[4,2],[5,1],[6,0],[7,1],[8,3],[9,2],[10,1],[11,2],[12,1]]}}",
"metaData": "{\"mysql\": [\"Create Table if not Exists Heights(id int, height int)\"], \"mssql\": [\"Create Table Heights(id int,height int)\"], \"oraclesql\": [\"Create Table Heights(id int,height int)\"], \"database\": true, \"name\": \"calculate_trapped_rain_water\", \"postgresql\": [\"CREATE TABLE Heights(\\n id int,\\n height int\\n);\\n\"], \"pythondata\": [\"Heights = pd.DataFrame([], columns=['id', 'height']).astype({'id':'Int64', 'height':'Int64'})\\n\"], \"database_schema\": {\"Heights\": {\"id\": \"INT\", \"height\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create Table if not Exists Heights(id int, height int)",
"Truncate table Heights",
"insert into Heights (id, height) values ('1', '0')",
"insert into Heights (id, height) values ('2', '1')",
"insert into Heights (id, height) values ('3', '0')",
"insert into Heights (id, height) values ('4', '2')",
"insert into Heights (id, height) values ('5', '1')",
"insert into Heights (id, height) values ('6', '0')",
"insert into Heights (id, height) values ('7', '1')",
"insert into Heights (id, height) values ('8', '3')",
"insert into Heights (id, height) values ('9', '2')",
"insert into Heights (id, height) values ('10', '1')",
"insert into Heights (id, height) values ('11', '2')",
"insert into Heights (id, height) values ('12', '1')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,50 @@
{
"data": {
"question": {
"questionId": "3258",
"questionFrontendId": "3053",
"boundTopicId": null,
"title": "Classifying Triangles by Lengths",
"titleSlug": "classifying-triangles-by-lengths",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 5,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Triangles\":[\"A\",\"B\",\"C\"]},\"rows\":{\"Triangles\":[[20,20,23],[20,20,20],[20,21,22],[13,14,30]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"271\", \"totalSubmission\": \"490\", \"totalAcceptedRaw\": 271, \"totalSubmissionRaw\": 490, \"acRate\": \"55.3%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Triangles\":[\"A\",\"B\",\"C\"]},\"rows\":{\"Triangles\":[[20,20,23],[20,20,20],[20,21,22],[13,14,30]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Triangles (A int, B int, C int)\"], \"mssql\": [\"Create table Triangles (A int, B int, C int)\"], \"oraclesql\": [\"Create table Triangles (A int, B int, C int)\"], \"database\": true, \"name\": \"type_of_triangle\", \"pythondata\": [\"Triangles = pd.DataFrame([], columns=['A', 'B', 'C']).astype({'A':'Int64', 'B':'Int64', 'C':'Int64'})\\n\"], \"postgresql\": [\"Create table If Not Exists Triangles (A int, B int, C int)\\n\"], \"database_schema\": {\"Triangles\": {\"A\": \"INT\", \"B\": \"INT\", \"C\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Triangles (A int, B int, C int)",
"Truncate table Triangles",
"insert into Triangles (A, B, C) values ('20', '20', '23')",
"insert into Triangles (A, B, C) values ('20', '20', '20')",
"insert into Triangles (A, B, C) values ('20', '21', '22')",
"insert into Triangles (A, B, C) values ('13', '14', '30')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,56 @@
{
"data": {
"question": {
"questionId": "3357",
"questionFrontendId": "3057",
"boundTopicId": null,
"title": "Employees Project Allocation",
"titleSlug": "employees-project-allocation",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 2,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Project\":[\"project_id\",\"employee_id\",\"workload\"],\"Employees\":[\"employee_id\",\"name\",\"team\"]},\"rows\":{\"Project\":[[1,1,45],[1,2,90],[2,3,12],[2,4,68]],\"Employees\":[[1,\"Khaled\",\"A\"],[2,\"Ali\",\"B\"],[3,\"John\",\"B\"],[4,\"Doe\",\"A\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"131\", \"totalSubmission\": \"165\", \"totalAcceptedRaw\": 131, \"totalSubmissionRaw\": 165, \"acRate\": \"79.4%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Project\":[\"project_id\",\"employee_id\",\"workload\"],\"Employees\":[\"employee_id\",\"name\",\"team\"]},\"rows\":{\"Project\":[[1,1,45],[1,2,90],[2,3,12],[2,4,68]],\"Employees\":[[1,\"Khaled\",\"A\"],[2,\"Ali\",\"B\"],[3,\"John\",\"B\"],[4,\"Doe\",\"A\"]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Project (project_id int, employee_id int, workload int)\", \"Create table If Not Exists Employees (employee_id int, name varchar(20), team varchar(20))\"], \"mssql\": [\"Create table Project (project_id int, employee_id int, workload int)\", \"Create table Employees (employee_id int, name varchar(20), team varchar(20))\"], \"oraclesql\": [\"Create table Project (project_id int, employee_id int, workload int)\", \"Create table Employees (employee_id int, name varchar(20), team varchar(20))\"], \"database\": true, \"name\": \"employees_with_above_avg_workload\", \"pythondata\": [\"Project = pd.DataFrame([], columns=['project_id', 'employee_id', 'workload']).astype({'project_id':'Int64', 'employee_id':'Int64', 'workload':'Int64'})\\n\", \"Employees = pd.DataFrame([], columns=['employee_id', 'name', 'team']).astype({'employee_id':'Int64', 'name':'object', 'team':'object'})\"], \"postgresql\": [\"CREATE TABLE Project (\\n project_id int,\\n employee_id int,\\n workload int\\n);\", \"CREATE TABLE Employees (\\n employee_id int,\\n name varchar(20),\\n team varchar(20)\\n);\"], \"database_schema\": {\"Project\": {\"project_id\": \"INT\", \"employee_id\": \"INT\", \"workload\": \"INT\"}, \"Employees\": {\"employee_id\": \"INT\", \"name\": \"VARCHAR(20)\", \"team\": \"VARCHAR(20)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Project (project_id int, employee_id int, workload int)",
"Create table If Not Exists Employees (employee_id int, name varchar(20), team varchar(20))",
"Truncate table Project",
"insert into Project (project_id, employee_id, workload) values ('1', '1', '45')",
"insert into Project (project_id, employee_id, workload) values ('1', '2', '90')",
"insert into Project (project_id, employee_id, workload) values ('2', '3', '12')",
"insert into Project (project_id, employee_id, workload) values ('2', '4', '68')",
"Truncate table Employees",
"insert into Employees (employee_id, name, team) values ('1', 'Khaled', 'A')",
"insert into Employees (employee_id, name, team) values ('2', 'Ali', 'B')",
"insert into Employees (employee_id, name, team) values ('3', 'John', 'B')",
"insert into Employees (employee_id, name, team) values ('4', 'Doe', 'A')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,52 @@
{
"data": {
"question": {
"questionId": "3365",
"questionFrontendId": "3059",
"boundTopicId": null,
"title": "Find All Unique Email Domains",
"titleSlug": "find-all-unique-email-domains",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 3,
"dislikes": 6,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Emails\":[\"id\",\"email\"]},\"rows\":{\"Emails\":[[336,\"hwkiy@test.edu\"],[489,\"adcmaf@outlook.com\"],[449,\"vrzmwyum@yahoo.com\"],[95,\"tof@test.edu\"],[320,\"jxhbagkpm@example.org\"],[411,\"zxcf@outlook.com\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"277\", \"totalSubmission\": \"490\", \"totalAcceptedRaw\": 277, \"totalSubmissionRaw\": 490, \"acRate\": \"56.5%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Emails\":[\"id\",\"email\"]},\"rows\":{\"Emails\":[[336,\"hwkiy@test.edu\"],[489,\"adcmaf@outlook.com\"],[449,\"vrzmwyum@yahoo.com\"],[95,\"tof@test.edu\"],[320,\"jxhbagkpm@example.org\"],[411,\"zxcf@outlook.com\"]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Emails (id int, email varchar(255))\"], \"mssql\": [\"Create table Emails (id int, email varchar(255))\"], \"oraclesql\": [\"Create table Emails (id int, email varchar(255))\"], \"database\": true, \"name\": \"find_unique_email_domains\", \"postgresql\": [\"CREATE TABLE Emails (\\n id INT,\\n email VARCHAR(255)\\n);\"], \"pythondata\": [\"Emails = pd.DataFrame([], columns=['id', 'email']).astype({'id':'Int64', 'email':'object'})\\n\"], \"database_schema\": {\"Emails\": {\"id\": \"INT\", \"email\": \"VARCHAR(255)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Emails (id int, email varchar(255))",
"Truncate table Emails",
"insert into Emails (id, email) values ('336', 'hwkiy@test.edu')",
"insert into Emails (id, email) values ('489', 'adcmaf@outlook.com')",
"insert into Emails (id, email) values ('449', 'vrzmwyum@yahoo.com')",
"insert into Emails (id, email) values ('95', 'tof@test.edu')",
"insert into Emails (id, email) values ('320', 'jxhbagkpm@example.org')",
"insert into Emails (id, email) values ('411', 'zxcf@outlook.com')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,58 @@
{
"data": {
"question": {
"questionId": "3256",
"questionFrontendId": "3051",
"boundTopicId": null,
"title": "Find Candidates for Data Scientist Position",
"titleSlug": "find-candidates-for-data-scientist-position",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 5,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Candidates\":[\"candidate_id\",\"skill\"]},\"rows\":{\"Candidates\":[[123,\"Python\"],[234,\"R\"],[123,\"Tableau\"],[123,\"PostgreSQL\"],[234,\"PowerBI\"],[234,\"SQL Server\"],[147,\"Python\"],[147,\"Tableau\"],[147,\"Java\"],[147,\"PostgreSQL\"],[256,\"Tableau\"],[102,\"DataAnalysis\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"418\", \"totalSubmission\": \"571\", \"totalAcceptedRaw\": 418, \"totalSubmissionRaw\": 571, \"acRate\": \"73.2%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Candidates\":[\"candidate_id\",\"skill\"]},\"rows\":{\"Candidates\":[[123,\"Python\"],[234,\"R\"],[123,\"Tableau\"],[123,\"PostgreSQL\"],[234,\"PowerBI\"],[234,\"SQL Server\"],[147,\"Python\"],[147,\"Tableau\"],[147,\"Java\"],[147,\"PostgreSQL\"],[256,\"Tableau\"],[102,\"DataAnalysis\"]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Candidates (candidate_id int, skill varchar(30))\"], \"mssql\": [\"Create table Candidates (candidate_id int, skill varchar(30))\"], \"oraclesql\": [\"Create table Candidates (candidate_id int, skill varchar(30))\"], \"database\": true, \"name\": \"find_candidates\", \"pythondata\": [\"Candidates = pd.DataFrame([], columns=['candidate_id', 'skill']).astype({'candidate_id':'Int64', 'skill':'object'})\\n\"], \"postgresql\": [\"Create table If Not Exists Candidates (candidate_id int, skill varchar(30))\\n\"], \"database_schema\": {\"Candidates\": {\"candidate_id\": \"INT\", \"skill\": \"VARCHAR(30)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Candidates (candidate_id int, skill varchar(30))",
"Truncate table Candidates",
"insert into Candidates (candidate_id, skill) values ('123', 'Python')",
"insert into Candidates (candidate_id, skill) values ('234', 'R')",
"insert into Candidates (candidate_id, skill) values ('123', 'Tableau')",
"insert into Candidates (candidate_id, skill) values ('123', 'PostgreSQL')",
"insert into Candidates (candidate_id, skill) values ('234', 'PowerBI')",
"insert into Candidates (candidate_id, skill) values ('234', 'SQL Server')",
"insert into Candidates (candidate_id, skill) values ('147', 'Python')",
"insert into Candidates (candidate_id, skill) values ('147', 'Tableau')",
"insert into Candidates (candidate_id, skill) values ('147', 'Java')",
"insert into Candidates (candidate_id, skill) values ('147', 'PostgreSQL')",
"insert into Candidates (candidate_id, skill) values ('256', 'Tableau')",
"insert into Candidates (candidate_id, skill) values ('102', 'DataAnalysis')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,54 @@
{
"data": {
"question": {
"questionId": "3358",
"questionFrontendId": "3058",
"boundTopicId": null,
"title": "Friends With No Mutual Friends",
"titleSlug": "friends-with-no-mutual-friends",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 2,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Friends\":[\"user_id1\",\"user_id2\"]},\"rows\":{\"Friends\":[[1,2],[2,3],[2,4],[1,5],[6,7],[3,4],[2,5],[8,9]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"113\", \"totalSubmission\": \"212\", \"totalAcceptedRaw\": 113, \"totalSubmissionRaw\": 212, \"acRate\": \"53.3%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Friends\":[\"user_id1\",\"user_id2\"]},\"rows\":{\"Friends\":[[1,2],[2,3],[2,4],[1,5],[6,7],[3,4],[2,5],[8,9]]}}",
"metaData": "{\"mysql\": [\"Create Table if Not Exists Friends( user_id1 int, user_id2 int)\"], \"mssql\": [\"Create Table Friends( user_id1 int, user_id2 int)\"], \"oraclesql\": [\"Create Table Friends( user_id1 int, user_id2 int)\"], \"database\": true, \"name\": \"friends_with_no_mutual_friends\", \"pythondata\": [\"Friends = pd.DataFrame([], columns=['user_id1', 'user_id2']).astype({'user_id1':'Int64', 'user_id2':'Int64'})\\n\"], \"postgresql\": [\"CREATE TABLE Friends (\\n user_id1 int,\\n user_id2 int\\n);\"], \"database_schema\": {\"Friends\": {\"user_id1\": \"INT\", \"user_id2\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create Table if Not Exists Friends( user_id1 int, user_id2 int)",
"Truncate table Friends",
"insert into Friends (user_id1, user_id2) values ('1', '2')",
"insert into Friends (user_id1, user_id2) values ('2', '3')",
"insert into Friends (user_id1, user_id2) values ('2', '4')",
"insert into Friends (user_id1, user_id2) values ('1', '5')",
"insert into Friends (user_id1, user_id2) values ('6', '7')",
"insert into Friends (user_id1, user_id2) values ('3', '4')",
"insert into Friends (user_id1, user_id2) values ('2', '5')",
"insert into Friends (user_id1, user_id2) values ('8', '9')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,56 @@
{
"data": {
"question": {
"questionId": "3257",
"questionFrontendId": "3052",
"boundTopicId": null,
"title": "Maximize Items",
"titleSlug": "maximize-items",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 1,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Inventory\":[\"item_id\",\"item_type\",\"item_category\",\"square_footage\"]},\"rows\":{\"Inventory\":[[1374,\"prime_eligible\",\"Watches\",68.00],[4245,\"not_prime\",\"Art\",26.40],[5743,\"prime_eligible\",\"Software\",325.00],[8543,\"not_prime\",\"Clothing\",64.50],[2556,\"not_prime\",\"Shoes\",15.00],[2452,\"prime_eligible\",\"Scientific\",85.00],[3255,\"not_prime\",\"Furniture\",22.60],[1672,\"prime_eligible\",\"Beauty\",8.50],[4256,\"prime_eligible\",\"Furniture\",55.50],[6325,\"prime_eligible\",\"Food\",13.20]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"119\", \"totalSubmission\": \"158\", \"totalAcceptedRaw\": 119, \"totalSubmissionRaw\": 158, \"acRate\": \"75.3%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Inventory\":[\"item_id\",\"item_type\",\"item_category\",\"square_footage\"]},\"rows\":{\"Inventory\":[[1374,\"prime_eligible\",\"Watches\",68.00],[4245,\"not_prime\",\"Art\",26.40],[5743,\"prime_eligible\",\"Software\",325.00],[8543,\"not_prime\",\"Clothing\",64.50],[2556,\"not_prime\",\"Shoes\",15.00],[2452,\"prime_eligible\",\"Scientific\",85.00],[3255,\"not_prime\",\"Furniture\",22.60],[1672,\"prime_eligible\",\"Beauty\",8.50],[4256,\"prime_eligible\",\"Furniture\",55.50],[6325,\"prime_eligible\",\"Food\",13.20]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Inventory ( item_id int, item_type varchar(50), item_category varchar(50), square_footage decimal(10,2))\"], \"mssql\": [\"Create table Inventory ( item_id int, item_type varchar(50), item_category varchar(50), square_footage decimal(10,2))\"], \"oraclesql\": [\"Create table Inventory ( item_id int, item_type varchar(50), item_category varchar(50), square_footage decimal(10,2))\"], \"database\": true, \"name\": \"maximize_items\", \"pythondata\": [\"Inventory = pd.DataFrame([], columns=['item_id', 'item_type', 'item_category', 'square_footage']).astype({'item_id':'Int64', 'item_type':'object', 'item_category':'object', 'square_footage':'Float64'})\\n\"], \"postgresql\": [\"Create table If Not Exists Inventory ( item_id int, item_type varchar(50), item_category varchar(50), square_footage decimal(10,2))\\n\"], \"database_schema\": {\"Inventory\": {\"item_id\": \"INT\", \"item_type\": \"VARCHAR(50)\", \"item_category\": \"VARCHAR(50)\", \"square_footage\": \"DECIMAL(10, 2)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Inventory ( item_id int, item_type varchar(50), item_category varchar(50), square_footage decimal(10,2))",
"Truncate table Inventory",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('1374', 'prime_eligible', 'Watches', '68.0')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('4245', 'not_prime', 'Art', '26.4')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('5743', 'prime_eligible', 'Software', '325.0')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('8543', 'not_prime', 'Clothing', '64.5')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('2556', 'not_prime', 'Shoes', '15.0')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('2452', 'prime_eligible', 'Scientific', '85.0')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('3255', 'not_prime', 'Furniture', '22.6')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('1672', 'prime_eligible', 'Beauty', '8.5')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('4256', 'prime_eligible', 'Furniture', '55.5')",
"insert into Inventory (item_id, item_type, item_category, square_footage) values ('6325', 'prime_eligible', 'Food', '13.2')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,50 @@
{
"data": {
"question": {
"questionId": "3255",
"questionFrontendId": "3050",
"boundTopicId": null,
"title": "Pizza Toppings Cost Analysis",
"titleSlug": "pizza-toppings-cost-analysis",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 1,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Toppings\":[\"topping_name\",\"cost\"]},\"rows\":{\"Toppings\":[[\"Pepperoni\",0.50],[\"Sausage\",0.70],[\"Chicken\",0.55],[\"Extra Cheese\",0.40]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"237\", \"totalSubmission\": \"303\", \"totalAcceptedRaw\": 237, \"totalSubmissionRaw\": 303, \"acRate\": \"78.2%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Toppings\":[\"topping_name\",\"cost\"]},\"rows\":{\"Toppings\":[[\"Pepperoni\",0.50],[\"Sausage\",0.70],[\"Chicken\",0.55],[\"Extra Cheese\",0.40]]}}",
"metaData": "{\"mysql\": [\"Create table if not exists Toppings(topping_name varchar(100), cost decimal(5,2))\"], \"mssql\": [\"Create table Toppings(topping_name varchar(100), cost decimal(5,2))\"], \"oraclesql\": [\"Create table Toppings(topping_name varchar(100), cost decimal(5,2))\"], \"database\": true, \"name\": \"cost_analysis\", \"pythondata\": [\"Toppings = pd.DataFrame([], columns=['topping_name', 'cost']).astype({'topping_name':'object', 'cost':'Float64'})\\n\"], \"postgresql\": [\"Create table if not exists Toppings(topping_name varchar(100), cost decimal(5,2))\\n\"], \"database_schema\": {\"Toppings\": {\"topping_name\": \"VARCHAR(100)\", \"cost\": \"DECIMAL(5, 2)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if not exists Toppings(topping_name varchar(100), cost decimal(5,2))",
"Truncate table Toppings",
"insert into Toppings (topping_name, cost) values ('Pepperoni', '0.5')",
"insert into Toppings (topping_name, cost) values ('Sausage', '0.7')",
"insert into Toppings (topping_name, cost) values ('Chicken', '0.55')",
"insert into Toppings (topping_name, cost) values ('Extra Cheese', '0.4')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,59 @@
{
"data": {
"question": {
"questionId": "3340",
"questionFrontendId": "3056",
"boundTopicId": null,
"title": "Snaps Analysis",
"titleSlug": "snaps-analysis",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 0,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Activities\":[\"activity_id\",\"user_id\",\"activity_type\",\"time_spent\"],\"Age\":[\"user_id\",\"age_bucket\"]},\"rows\":{\"Activities\":[[7274,123,\"open\",4.50],[2425,123,\"send\",3.50],[1413,456,\"send\",5.67],[2536,456,\"open\",3.00],[8564,456,\"send\",8.24],[5235,789,\"send\",6.24],[4251,123,\"open\",1.25],[1435,789,\"open\",5.25]],\"Age\":[[123,\"31-35\"],[789,\"21-25\"],[456,\"26-30\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"157\", \"totalSubmission\": \"228\", \"totalAcceptedRaw\": 157, \"totalSubmissionRaw\": 228, \"acRate\": \"68.9%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Activities\":[\"activity_id\",\"user_id\",\"activity_type\",\"time_spent\"],\"Age\":[\"user_id\",\"age_bucket\"]},\"rows\":{\"Activities\":[[7274,123,\"open\",4.50],[2425,123,\"send\",3.50],[1413,456,\"send\",5.67],[2536,456,\"open\",3.00],[8564,456,\"send\",8.24],[5235,789,\"send\",6.24],[4251,123,\"open\",1.25],[1435,789,\"open\",5.25]],\"Age\":[[123,\"31-35\"],[789,\"21-25\"],[456,\"26-30\"]]}}",
"metaData": "{\"mysql\": [\"Create table if Not Exists Activities(activity_id int, user_id int, activity_type ENUM('send', 'open'), time_spent decimal(5,2))\", \"Create table if not Exists Age( user_id int, age_bucket ENUM('21-25','26-30','31-35'))\"], \"mssql\": [\"Create table Activities (activity_id int, user_id int, activity_type varchar(30) NOT NULL CHECK (activity_type IN ('send','open')), time_spent decimal(5,2))\", \"Create table Age( user_id int, age_bucket varchar(30) NOT NULL CHECK ( age_bucket IN ('21-25','26-30','31-35')))\"], \"oraclesql\": [\"Create table Activities (activity_id int, user_id int, activity_type varchar(30) NOT NULL CHECK (activity_type IN ('send','open')), time_spent decimal(5,2))\", \"Create table Age( user_id int, age_bucket varchar(30) NOT NULL CHECK ( age_bucket IN ('21-25','26-30','31-35')))\"], \"database\": true, \"name\": \"snap_analysis\", \"pythondata\": [\"Activities = pd.DataFrame([], columns=['activity_id', 'user_id', 'activity_type', 'time_spent']).astype({'activity_id':'Int64', 'user_id':'Int64', 'activity_type':'object', 'time_spent':'Float64'})\\n\", \"Age = pd.DataFrame([], columns=['user_id', 'age_bucket']).astype({'user_id':'Int64', 'age_bucket':'object'})\\n\"], \"postgresql\": [\"CREATE TABLE Activities (\\n activity_id SERIAL PRIMARY KEY,\\n user_id INT,\\n activity_type VARCHAR(30) NOT NULL CHECK (activity_type IN ('send', 'open')),\\n time_spent DECIMAL(5,2)\\n);\", \"CREATE TABLE Age (\\n user_id INT,\\n age_bucket VARCHAR(30) NOT NULL CHECK (age_bucket IN ('21-25', '26-30', '31-35'))\\n);\"], \"database_schema\": {\"Activities\": {\"activity_id\": \"INT\", \"user_id\": \"INT\", \"activity_type\": \"ENUM('send', 'open')\", \"time_spent\": \"DECIMAL(5, 2)\"}, \"Age\": {\"user_id\": \"INT\", \"age_bucket\": \"ENUM('21-25', '26-30', '31-35')\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if Not Exists Activities(activity_id int, user_id int, activity_type ENUM('send', 'open'), time_spent decimal(5,2))",
"Create table if not Exists Age( user_id int, age_bucket ENUM('21-25','26-30','31-35'))",
"Truncate table Activities",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('7274', '123', 'open', '4.5')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('2425', '123', 'send', '3.5')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('1413', '456', 'send', '5.67')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('2536', '456', 'open', '3.0')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('8564', '456', 'send', '8.24')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('5235', '789', 'send', '6.24')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('4251', '123', 'open', '1.25')",
"insert into Activities (activity_id, user_id, activity_type, time_spent) values ('1435', '789', 'open', '5.25')",
"Truncate table Age",
"insert into Age (user_id, age_bucket) values ('123', '31-35')",
"insert into Age (user_id, age_bucket) values ('789', '21-25')",
"insert into Age (user_id, age_bucket) values ('456', '26-30')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,60 @@
{
"data": {
"question": {
"questionId": "3339",
"questionFrontendId": "3055",
"boundTopicId": null,
"title": "Top Percentile Fraud",
"titleSlug": "top-percentile-fraud",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 1,
"dislikes": 3,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Fraud\":[\"policy_id\",\"state\",\"fraud_score\"]},\"rows\":{\"Fraud\":[[1,\"California\",0.92],[2,\"California\",0.68],[3,\"California\",0.17],[4,\"New York\",0.94],[5,\"New York\",0.81],[6,\"New York\",0.77],[7,\"Texas\",0.98],[8,\"Texas\",0.97],[9,\"Texas\",0.96],[10,\"Florida\",0.97],[11,\"Florida\",0.98],[12,\"Florida\",0.78],[13,\"Florida\",0.88],[14,\"Florida\",0.66]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"141\", \"totalSubmission\": \"210\", \"totalAcceptedRaw\": 141, \"totalSubmissionRaw\": 210, \"acRate\": \"67.1%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Fraud\":[\"policy_id\",\"state\",\"fraud_score\"]},\"rows\":{\"Fraud\":[[1,\"California\",0.92],[2,\"California\",0.68],[3,\"California\",0.17],[4,\"New York\",0.94],[5,\"New York\",0.81],[6,\"New York\",0.77],[7,\"Texas\",0.98],[8,\"Texas\",0.97],[9,\"Texas\",0.96],[10,\"Florida\",0.97],[11,\"Florida\",0.98],[12,\"Florida\",0.78],[13,\"Florida\",0.88],[14,\"Florida\",0.66]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Fraud (policy_id int, state varchar(50), fraud_score decimal(5,2))\"], \"mssql\": [\"Create table Fraud (policy_id int, state varchar(50), fraud_score decimal(5,2))\"], \"oraclesql\": [\"Create table Fraud (policy_id int, state varchar(50), fraud_score decimal(10,2))\"], \"database\": true, \"name\": \"top_percentile_fraud\", \"pythondata\": [\"Fraud = pd.DataFrame([], columns=['policy_id', 'state', 'fraud_score']).astype({'policy_id':'Int64', 'state':'object', 'fraud_score':'Float64'})\\n\"], \"postgresql\": [\"Create table If Not Exists Fraud (policy_id int, state varchar(50), fraud_score decimal(5,2))\\n\"], \"database_schema\": {\"Fraud\": {\"policy_id\": \"INT\", \"state\": \"VARCHAR(50)\", \"fraud_score\": \"DECIMAL(5, 2)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Fraud (policy_id int, state varchar(50), fraud_score decimal(5,2))",
"Truncate table Fraud",
"insert into Fraud (policy_id, state, fraud_score) values ('1', 'California', '0.92')",
"insert into Fraud (policy_id, state, fraud_score) values ('2', 'California', '0.68')",
"insert into Fraud (policy_id, state, fraud_score) values ('3', 'California', '0.17')",
"insert into Fraud (policy_id, state, fraud_score) values ('4', 'New York', '0.94')",
"insert into Fraud (policy_id, state, fraud_score) values ('5', 'New York', '0.81')",
"insert into Fraud (policy_id, state, fraud_score) values ('6', 'New York', '0.77')",
"insert into Fraud (policy_id, state, fraud_score) values ('7', 'Texas', '0.98')",
"insert into Fraud (policy_id, state, fraud_score) values ('8', 'Texas', '0.97')",
"insert into Fraud (policy_id, state, fraud_score) values ('9', 'Texas', '0.96')",
"insert into Fraud (policy_id, state, fraud_score) values ('10', 'Florida', '0.97')",
"insert into Fraud (policy_id, state, fraud_score) values ('11', 'Florida', '0.98')",
"insert into Fraud (policy_id, state, fraud_score) values ('12', 'Florida', '0.78')",
"insert into Fraud (policy_id, state, fraud_score) values ('13', 'Florida', '0.88')",
"insert into Fraud (policy_id, state, fraud_score) values ('14', 'Florida', '0.66')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@@ -0,0 +1,57 @@
{
"data": {
"question": {
"questionId": "3366",
"questionFrontendId": "3060",
"boundTopicId": null,
"title": "User Activities within Time Bounds",
"titleSlug": "user-activities-within-time-bounds",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 2,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Sessions\":[\"user_id\",\"session_start\",\"session_end\",\"session_id\",\"session_type\"]},\"rows\":{\"Sessions\":[[101,\"2023-11-01 08:00:00\",\"2023-11-01 09:00:00\",1,\"Viewer\"],[101,\"2023-11-01 10:00:00\",\"2023-11-01 11:00:00\",2,\"Streamer\"],[102,\"2023-11-01 13:00:00\",\"2023-11-01 14:00:00\",3,\"Viewer\"],[102,\"2023-11-01 15:00:00\",\"2023-11-01 16:00:00\",4,\"Viewer\"],[101,\"2023-11-02 09:00:00\",\"2023-11-02 10:00:00\",5,\"Viewer\"],[102,\"2023-11-02 12:00:00\",\"2023-11-02 13:00:00\",6,\"Streamer\"],[101,\"2023-11-02 13:00:00\",\"2023-11-02 14:00:00\",7,\"Streamer\"],[102,\"2023-11-02 16:00:00\",\"2023-11-02 17:00:00\",8,\"Viewer\"],[103,\"2023-11-01 08:00:00\",\"2023-11-01 09:00:00\",9,\"Viewer\"],[103,\"2023-11-02 20:00:00\",\"2023-11-02 23:00:00\",10,\"Viewer\"],[103,\"2023-11-03 09:00:00\",\"2023-11-03 10:00:00\",11,\"Viewer\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"116\", \"totalSubmission\": \"279\", \"totalAcceptedRaw\": 116, \"totalSubmissionRaw\": 279, \"acRate\": \"41.6%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Sessions\":[\"user_id\",\"session_start\",\"session_end\",\"session_id\",\"session_type\"]},\"rows\":{\"Sessions\":[[101,\"2023-11-01 08:00:00\",\"2023-11-01 09:00:00\",1,\"Viewer\"],[101,\"2023-11-01 10:00:00\",\"2023-11-01 11:00:00\",2,\"Streamer\"],[102,\"2023-11-01 13:00:00\",\"2023-11-01 14:00:00\",3,\"Viewer\"],[102,\"2023-11-01 15:00:00\",\"2023-11-01 16:00:00\",4,\"Viewer\"],[101,\"2023-11-02 09:00:00\",\"2023-11-02 10:00:00\",5,\"Viewer\"],[102,\"2023-11-02 12:00:00\",\"2023-11-02 13:00:00\",6,\"Streamer\"],[101,\"2023-11-02 13:00:00\",\"2023-11-02 14:00:00\",7,\"Streamer\"],[102,\"2023-11-02 16:00:00\",\"2023-11-02 17:00:00\",8,\"Viewer\"],[103,\"2023-11-01 08:00:00\",\"2023-11-01 09:00:00\",9,\"Viewer\"],[103,\"2023-11-02 20:00:00\",\"2023-11-02 23:00:00\",10,\"Viewer\"],[103,\"2023-11-03 09:00:00\",\"2023-11-03 10:00:00\",11,\"Viewer\"]]}}",
"metaData": "{\"mysql\": [\"Create table If Not Exists Sessions (user_id int, session_start datetime, session_end datetime, session_id int, session_type ENUM('Viewer','Streamer'))\"], \"mssql\": [\"Create table Sessions (user_id int, session_start datetime, session_end datetime, session_id int, session_type varchar(20) NOT NULL CHECK (session_type in ('Viewer', 'Streamer' )))\"], \"oraclesql\": [\"Create table Sessions (user_id int, session_start date, session_end date, session_id int, session_type varchar(20) NOT NULL CHECK (session_type in ('Viewer', 'Streamer' )))\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"name\": \"user_activities\", \"postgresql\": [\"CREATE TABLE Sessions (\\n user_id INT,\\n session_start TIMESTAMP,\\n session_end TIMESTAMP,\\n session_id INT,\\n session_type VARCHAR(20) NOT NULL CHECK (session_type IN ('Viewer', 'Streamer'))\\n);\\n\"], \"pythondata\": [\"Sessions = pd.DataFrame(columns=['user_id', 'session_start', 'session_end', 'session_id', 'session_type']).astype({'user_id': 'Int64', 'session_start': 'datetime64[ns]', 'session_end': 'datetime64[ns]', 'session_id': 'Int64', 'session_type': 'object'})\\n\"], \"database_schema\": {\"Sessions\": {\"user_id\": \"INT\", \"session_start\": \"DATETIME\", \"session_end\": \"DATETIME\", \"session_id\": \"INT\", \"session_type\": \"ENUM('Viewer', 'Streamer')\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Sessions (user_id int, session_start datetime, session_end datetime, session_id int, session_type ENUM('Viewer','Streamer'))",
"Truncate table Sessions",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-01 08:00:00', '2023-11-01 09:00:00', '1', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-01 10:00:00', '2023-11-01 11:00:00', '2', 'Streamer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('102', '2023-11-01 13:00:00', '2023-11-01 14:00:00', '3', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('102', '2023-11-01 15:00:00', '2023-11-01 16:00:00', '4', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-02 09:00:00', '2023-11-02 10:00:00', '5', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('102', '2023-11-02 12:00:00', '2023-11-02 13:00:00', '6', 'Streamer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-02 13:00:00', '2023-11-02 14:00:00', '7', 'Streamer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('102', '2023-11-02 16:00:00', '2023-11-02 17:00:00', '8', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('103', '2023-11-01 08:00:00', '2023-11-01 09:00:00', '9', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('103', '2023-11-02 20:00:00', '2023-11-02 23:00:00', '10', 'Viewer')",
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('103', '2023-11-03 09:00:00', '2023-11-03 10:00:00', '11', 'Viewer')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,69 @@
<p>You are given two <strong>1-indexed</strong> integer arrays, <code>nums</code> and, <code>changeIndices</code>, having lengths <code>n</code> and <code>m</code>, respectively.</p>
<p>Initially, all indices in <code>nums</code> are unmarked. Your task is to mark <strong>all</strong> indices in <code>nums</code>.</p>
<p>In each second, <code>s</code>, in order from <code>1</code> to <code>m</code> (<strong>inclusive</strong>), you can perform <strong>one</strong> of the following operations:</p>
<ul>
<li>Choose an index <code>i</code> in the range <code>[1, n]</code> and <strong>decrement</strong> <code>nums[i]</code> by <code>1</code>.</li>
<li>If <code>nums[changeIndices[s]]</code> is <strong>equal</strong> to <code>0</code>, <strong>mark</strong> the index <code>changeIndices[s]</code>.</li>
<li>Do nothing.</li>
</ul>
<p>Return <em>an integer denoting the <strong>earliest second</strong> in the range </em><code>[1, m]</code><em> when <strong>all</strong> indices in </em><code>nums</code><em> can be marked by choosing operations optimally, or </em><code>-1</code><em> if it is impossible.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [2,2,0], changeIndices = [2,2,2,2,3,2,2,1]
<strong>Output:</strong> 8
<strong>Explanation:</strong> In this example, we have 8 seconds. The following operations can be performed to mark all indices:
Second 1: Choose index 1 and decrement nums[1] by one. nums becomes [1,2,0].
Second 2: Choose index 1 and decrement nums[1] by one. nums becomes [0,2,0].
Second 3: Choose index 2 and decrement nums[2] by one. nums becomes [0,1,0].
Second 4: Choose index 2 and decrement nums[2] by one. nums becomes [0,0,0].
Second 5: Mark the index changeIndices[5], which is marking index 3, since nums[3] is equal to 0.
Second 6: Mark the index changeIndices[6], which is marking index 2, since nums[2] is equal to 0.
Second 7: Do nothing.
Second 8: Mark the index changeIndices[8], which is marking index 1, since nums[1] is equal to 0.
Now all indices have been marked.
It can be shown that it is not possible to mark all indices earlier than the 8th second.
Hence, the answer is 8.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,3], changeIndices = [1,1,1,2,1,1,1]
<strong>Output:</strong> 6
<strong>Explanation:</strong> In this example, we have 7 seconds. The following operations can be performed to mark all indices:
Second 1: Choose index 2 and decrement nums[2] by one. nums becomes [1,2].
Second 2: Choose index 2 and decrement nums[2] by one. nums becomes [1,1].
Second 3: Choose index 2 and decrement nums[2] by one. nums becomes [1,0].
Second 4: Mark the index changeIndices[4], which is marking index 2, since nums[2] is equal to 0.
Second 5: Choose index 1 and decrement nums[1] by one. nums becomes [0,0].
Second 6: Mark the index changeIndices[6], which is marking index 1, since nums[1] is equal to 0.
Now all indices have been marked.
It can be shown that it is not possible to mark all indices earlier than the 6th second.
Hence, the answer is 6.
</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> nums = [0,1], changeIndices = [2,2,2]
<strong>Output:</strong> -1
<strong>Explanation:</strong> In this example, it is impossible to mark all indices because index 1 isn&#39;t in changeIndices.
Hence, the answer is -1.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 2000</code></li>
<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= m == changeIndices.length &lt;= 2000</code></li>
<li><code>1 &lt;= changeIndices[i] &lt;= n</code></li>
</ul>

View File

@@ -0,0 +1,69 @@
<p>You are given two <strong>1-indexed</strong> integer arrays, <code>nums</code> and, <code>changeIndices</code>, having lengths <code>n</code> and <code>m</code>, respectively.</p>
<p>Initially, all indices in <code>nums</code> are unmarked. Your task is to mark <strong>all</strong> indices in <code>nums</code>.</p>
<p>In each second, <code>s</code>, in order from <code>1</code> to <code>m</code> (<strong>inclusive</strong>), you can perform <strong>one</strong> of the following operations:</p>
<ul>
<li>Choose an index <code>i</code> in the range <code>[1, n]</code> and <strong>decrement</strong> <code>nums[i]</code> by <code>1</code>.</li>
<li>Set <code>nums[changeIndices[s]]</code> to any <strong>non-negative</strong> value.</li>
<li>Choose an index <code>i</code> in the range <code>[1, n]</code>, where <code>nums[i]</code> is <strong>equal</strong> to <code>0</code>, and <strong>mark</strong> index <code>i</code>.</li>
<li>Do nothing.</li>
</ul>
<p>Return <em>an integer denoting the <strong>earliest second</strong> in the range </em><code>[1, m]</code><em> when <strong>all</strong> indices in </em><code>nums</code><em> can be marked by choosing operations optimally, or </em><code>-1</code><em> if it is impossible.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [3,2,3], changeIndices = [1,3,2,2,2,2,3]
<strong>Output:</strong> 6
<strong>Explanation:</strong> In this example, we have 7 seconds. The following operations can be performed to mark all indices:
Second 1: Set nums[changeIndices[1]] to 0. nums becomes [0,2,3].
Second 2: Set nums[changeIndices[2]] to 0. nums becomes [0,2,0].
Second 3: Set nums[changeIndices[3]] to 0. nums becomes [0,0,0].
Second 4: Mark index 1, since nums[1] is equal to 0.
Second 5: Mark index 2, since nums[2] is equal to 0.
Second 6: Mark index 3, since nums[3] is equal to 0.
Now all indices have been marked.
It can be shown that it is not possible to mark all indices earlier than the 6th second.
Hence, the answer is 6.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [0,0,1,2], changeIndices = [1,2,1,2,1,2,1,2]
<strong>Output:</strong> 7
<strong>Explanation:</strong> In this example, we have 8 seconds. The following operations can be performed to mark all indices:
Second 1: Mark index 1, since nums[1] is equal to 0.
Second 2: Mark index 2, since nums[2] is equal to 0.
Second 3: Decrement index 4 by one. nums becomes [0,0,1,1].
Second 4: Decrement index 4 by one. nums becomes [0,0,1,0].
Second 5: Decrement index 3 by one. nums becomes [0,0,0,0].
Second 6: Mark index 3, since nums[3] is equal to 0.
Second 7: Mark index 4, since nums[4] is equal to 0.
Now all indices have been marked.
It can be shown that it is not possible to mark all indices earlier than the 7th second.
Hence, the answer is 7.
</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,2,3], changeIndices = [1,2,3]
<strong>Output:</strong> -1
<strong>Explanation: </strong>In this example, it can be shown that it is impossible to mark all indices, as we don&#39;t have enough seconds.
Hence, the answer is -1.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 5000</code></li>
<li><code>0 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= m == changeIndices.length &lt;= 5000</code></li>
<li><code>1 &lt;= changeIndices[i] &lt;= n</code></li>
</ul>

View File

@@ -0,0 +1,46 @@
<p>There exist <code>n</code> rectangles in a 2D plane. You are given two <strong>0-indexed</strong> 2D integer arrays <code>bottomLeft</code> and <code>topRight</code>, both of size <code>n x 2</code>, where <code>bottomLeft[i]</code> and <code>topRight[i]</code> represent the <strong>bottom-left</strong> and <strong>top-right</strong> coordinates of the <code>i<sup>th</sup></code> rectangle respectively.</p>
<p>You can select a region formed from the <strong>intersection</strong> of&nbsp;two of the given rectangles. You need to find the <strong>largest </strong>area of a <strong>square</strong> that can fit <strong>inside</strong> this region if you select the region optimally.</p>
<p>Return <em>the <strong>largest </strong>possible area of a square, or </em><code>0</code><em> if there <strong>do not</strong> exist any intersecting regions between the rectangles</em>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2024/01/05/example12.png" style="width: 443px; height: 364px; padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem;" />
<pre>
<strong>Input:</strong> bottomLeft = [[1,1],[2,2],[3,1]], topRight = [[3,3],[4,4],[6,6]]
<strong>Output:</strong> 1
<strong>Explanation:</strong> A square with side length 1 can fit inside either the intersecting region of rectangle 0 and rectangle 1, or the intersecting region of rectangle 1 and rectangle 2. Hence the largest area is side * side which is 1 * 1 == 1.
It can be shown that a square with a greater side length can not fit inside any intersecting region.
</pre>
<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2024/01/04/rectanglesexample2.png" style="padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem; width: 445px; height: 365px;" />
<pre>
<strong>Input:</strong> bottomLeft = [[1,1],[2,2],[1,2]], topRight = [[3,3],[4,4],[3,4]]
<strong>Output:</strong> 1
<strong>Explanation:</strong> A square with side length 1 can fit inside either the intersecting region of rectangle 0 and rectangle 1, the intersecting region of rectangle 1 and rectangle 2, or the intersection region of all 3 rectangles. Hence the largest area is side * side which is 1 * 1 == 1.
It can be shown that a square with a greater side length can not fit inside any intersecting region.
Note that the region can be formed by the intersection of more than 2 rectangles.
</pre>
<p><strong class="example">Example 3:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2024/01/04/rectanglesexample3.png" style="padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem; width: 444px; height: 364px;" />
<pre>
<strong>Input:</strong> bottomLeft = [[1,1],[3,3],[3,1]], topRight = [[2,2],[4,4],[4,2]]
<strong>Output:</strong> 0
<strong>Explanation:</strong> No pair of rectangles intersect, hence, we return 0.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>n == bottomLeft.length == topRight.length</code></li>
<li><code>2 &lt;= n &lt;= 10<sup>3</sup></code></li>
<li><code>bottomLeft[i].length == topRight[i].length == 2</code></li>
<li><code>1 &lt;= bottomLeft[i][0], bottomLeft[i][1] &lt;= 10<sup>7</sup></code></li>
<li><code>1 &lt;= topRight[i][0], topRight[i][1] &lt;= 10<sup>7</sup></code></li>
<li><code>bottomLeft[i][0] &lt; topRight[i][0]</code></li>
<li><code>bottomLeft[i][1] &lt; topRight[i][1]</code></li>
</ul>

View File

@@ -0,0 +1,35 @@
<p>You are given an integer array <code>nums</code> of <strong>even</strong> length. You have to split the array into two parts <code>nums1</code> and <code>nums2</code> such that:</p>
<ul>
<li><code>nums1.length == nums2.length == nums.length / 2</code>.</li>
<li><code>nums1</code> should contain <strong>distinct </strong>elements.</li>
<li><code>nums2</code> should also contain <strong>distinct</strong> elements.</li>
</ul>
<p>Return <code>true</code><em> if it is possible to split the array, and </em><code>false</code> <em>otherwise</em><em>.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,1,2,2,3,4]
<strong>Output:</strong> true
<strong>Explanation:</strong> One of the possible ways to split nums is nums1 = [1,2,3] and nums2 = [1,2,4].
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,1,1,1]
<strong>Output:</strong> false
<strong>Explanation:</strong> The only possible way to split nums is nums1 = [1,1] and nums2 = [1,1]. Both nums1 and nums2 do not contain distinct elements. Therefore, we return false.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
<li><code>nums.length % 2 == 0 </code></li>
<li><code>1 &lt;= nums[i] &lt;= 100</code></li>
</ul>