mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
update
This commit is contained in:
parent
5028bd771c
commit
e31313baa5
@ -1,6 +1,6 @@
|
||||
# 力扣题库(完整版)
|
||||
|
||||
> 最后更新日期: **2024.02.19**
|
||||
> 最后更新日期: **2024.03.01**
|
||||
>
|
||||
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
56
leetcode-cn/originData/[no content]binary-tree-nodes.json
Normal file
56
leetcode-cn/originData/[no content]binary-tree-nodes.json
Normal file
@ -0,0 +1,56 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3259",
|
||||
"questionFrontendId": "100177",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653971,
|
||||
"title": "Binary Tree Nodes",
|
||||
"titleSlug": "binary-tree-nodes",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"23\", \"totalSubmission\": \"30\", \"totalAcceptedRaw\": 23, \"totalSubmissionRaw\": 30, \"acRate\": \"76.7%\"}",
|
||||
"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,
|
||||
"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\":{\"Tree\":[\"N\",\"P\"]},\"rows\":{\"Tree\":[[1,2],[3,2],[6,8],[9,8],[2,5],[8,5],[5,null]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3369",
|
||||
"questionFrontendId": "3061",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2658813,
|
||||
"title": "Calculate Trapping Rain Water",
|
||||
"titleSlug": "calculate-trapping-rain-water",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"8\", \"totalSubmission\": \"8\", \"totalAcceptedRaw\": 8, \"totalSubmissionRaw\": 8, \"acRate\": \"100.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,
|
||||
"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\":{\"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3258",
|
||||
"questionFrontendId": "100176",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2644304,
|
||||
"title": "Classifying Triangles by Lengths",
|
||||
"titleSlug": "classifying-triangles-by-lengths",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 1,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"37\", \"totalSubmission\": \"48\", \"totalAcceptedRaw\": 37, \"totalSubmissionRaw\": 48, \"acRate\": \"77.1%\"}",
|
||||
"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,
|
||||
"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\":{\"Triangles\":[\"A\",\"B\",\"C\"]},\"rows\":{\"Triangles\":[[20,20,23],[20,20,20],[20,21,22],[13,14,30]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3357",
|
||||
"questionFrontendId": "100252",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653974,
|
||||
"title": "Employees Project Allocation",
|
||||
"titleSlug": "employees-project-allocation",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"8\", \"totalSubmission\": \"14\", \"totalAcceptedRaw\": 8, \"totalSubmissionRaw\": 14, \"acRate\": \"57.1%\"}",
|
||||
"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,
|
||||
"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\":{\"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3365",
|
||||
"questionFrontendId": "100260",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653967,
|
||||
"title": "Find All Unique Email Domains",
|
||||
"titleSlug": "find-all-unique-email-domains",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 1,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"40\", \"totalSubmission\": \"60\", \"totalAcceptedRaw\": 40, \"totalSubmissionRaw\": 60, \"acRate\": \"66.7%\"}",
|
||||
"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,
|
||||
"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\":{\"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3256",
|
||||
"questionFrontendId": "100174",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653973,
|
||||
"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": 1,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"54\", \"totalSubmission\": \"70\", \"totalAcceptedRaw\": 54, \"totalSubmissionRaw\": 70, \"acRate\": \"77.1%\"}",
|
||||
"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,
|
||||
"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\":{\"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3358",
|
||||
"questionFrontendId": "100253",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653965,
|
||||
"title": "Friends With No Mutual Friends",
|
||||
"titleSlug": "friends-with-no-mutual-friends",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"17\", \"totalSubmission\": \"39\", \"totalAcceptedRaw\": 17, \"totalSubmissionRaw\": 39, \"acRate\": \"43.6%\"}",
|
||||
"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,
|
||||
"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\":{\"Friends\":[\"user_id1\",\"user_id2\"]},\"rows\":{\"Friends\":[[1,2],[2,3],[2,4],[1,5],[6,7],[3,4],[2,5],[8,9]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
59
leetcode-cn/originData/[no content]maximize-items.json
Normal file
59
leetcode-cn/originData/[no content]maximize-items.json
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3257",
|
||||
"questionFrontendId": "100175",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653972,
|
||||
"title": "Maximize Items",
|
||||
"titleSlug": "maximize-items",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"13\", \"totalSubmission\": \"15\", \"totalAcceptedRaw\": 13, \"totalSubmissionRaw\": 15, \"acRate\": \"86.7%\"}",
|
||||
"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,
|
||||
"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\":{\"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3255",
|
||||
"questionFrontendId": "100173",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653968,
|
||||
"title": "Pizza Toppings Cost Analysis",
|
||||
"titleSlug": "pizza-toppings-cost-analysis",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"30\", \"totalSubmission\": \"42\", \"totalAcceptedRaw\": 30, \"totalSubmissionRaw\": 42, \"acRate\": \"71.4%\"}",
|
||||
"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,
|
||||
"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\":{\"Toppings\":[\"topping_name\",\"cost\"]},\"rows\":{\"Toppings\":[[\"Pepperoni\",0.50],[\"Sausage\",0.70],[\"Chicken\",0.55],[\"Extra Cheese\",0.40]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
62
leetcode-cn/originData/[no content]snaps-analysis.json
Normal file
62
leetcode-cn/originData/[no content]snaps-analysis.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3340",
|
||||
"questionFrontendId": "100239",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653966,
|
||||
"title": "Snaps Analysis",
|
||||
"titleSlug": "snaps-analysis",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"20\", \"totalSubmission\": \"47\", \"totalAcceptedRaw\": 20, \"totalSubmissionRaw\": 47, \"acRate\": \"42.6%\"}",
|
||||
"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,
|
||||
"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\":{\"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
63
leetcode-cn/originData/[no content]top-percentile-fraud.json
Normal file
63
leetcode-cn/originData/[no content]top-percentile-fraud.json
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3339",
|
||||
"questionFrontendId": "100238",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653969,
|
||||
"title": "Top Percentile Fraud",
|
||||
"titleSlug": "top-percentile-fraud",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"12\", \"totalSubmission\": \"20\", \"totalAcceptedRaw\": 12, \"totalSubmissionRaw\": 20, \"acRate\": \"60.0%\"}",
|
||||
"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,
|
||||
"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\":{\"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3366",
|
||||
"questionFrontendId": "100261",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2653970,
|
||||
"title": "User Activities within Time Bounds",
|
||||
"titleSlug": "user-activities-within-time-bounds",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"10\", \"totalSubmission\": \"32\", \"totalAcceptedRaw\": 10, \"totalSubmissionRaw\": 32, \"acRate\": \"31.2%\"}",
|
||||
"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,
|
||||
"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\":{\"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
179
leetcode-cn/originData/earliest-second-to-mark-indices-i.json
Normal file
179
leetcode-cn/originData/earliest-second-to-mark-indices-i.json
Normal file
File diff suppressed because one or more lines are too long
188
leetcode-cn/originData/earliest-second-to-mark-indices-ii.json
Normal file
188
leetcode-cn/originData/earliest-second-to-mark-indices-ii.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
182
leetcode-cn/originData/split-the-array.json
Normal file
182
leetcode-cn/originData/split-the-array.json
Normal file
File diff suppressed because one or more lines are too long
37
leetcode-cn/problem (Chinese)/分割数组 [split-the-array].html
Normal file
37
leetcode-cn/problem (Chinese)/分割数组 [split-the-array].html
Normal file
@ -0,0 +1,37 @@
|
||||
<p>给你一个长度为 <strong>偶数 </strong>的整数数组 <code>nums</code> 。你需要将这个数组分割成 <code>nums1</code> 和 <code>nums2</code> 两部分,要求:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>nums1.length == nums2.length == nums.length / 2</code> 。</li>
|
||||
<li><code>nums1</code> 应包含 <strong>互不相同</strong><strong> </strong>的元素。</li>
|
||||
<li><code>nums2</code>也应包含<strong> 互不相同</strong> 的元素。</li>
|
||||
</ul>
|
||||
|
||||
<p>如果能够分割数组就返回 <code>true</code> ,否则返回 <code>false</code> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [1,1,2,2,3,4]
|
||||
<strong>输出:</strong>true
|
||||
<strong>解释:</strong>分割 nums 的可行方案之一是 nums1 = [1,2,3] 和 nums2 = [1,2,4] 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [1,1,1,1]
|
||||
<strong>输出:</strong>false
|
||||
<strong>解释:</strong>分割 nums 的唯一可行方案是 nums1 = [1,1] 和 nums2 = [1,1] 。但 nums1 和 nums2 都不是由互不相同的元素构成。因此,返回 false 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 100</code></li>
|
||||
<li><code>nums.length % 2 == 0</code></li>
|
||||
<li><code>1 <= nums[i] <= 100</code></li>
|
||||
</ul>
|
@ -0,0 +1,71 @@
|
||||
<p>给你两个下标从 <strong>1</strong> 开始的整数数组 <code>nums</code> 和 <code>changeIndices</code> ,数组的长度分别为 <code>n</code> 和 <code>m</code> 。</p>
|
||||
|
||||
<p>一开始,<code>nums</code> 中所有下标都是未标记的,你的任务是标记 <code>nums</code> 中 <strong>所有</strong> 下标。</p>
|
||||
|
||||
<p>从第 <code>1</code> 秒到第 <code>m</code> 秒(<b>包括 </b>第 <code>m</code> 秒),对于每一秒 <code>s</code> ,你可以执行以下操作 <strong>之一</strong> :</p>
|
||||
|
||||
<ul>
|
||||
<li>选择范围 <code>[1, n]</code> 中的一个下标 <code>i</code> ,并且将 <code>nums[i]</code> <strong>减少</strong> <code>1</code> 。</li>
|
||||
<li>如果 <code>nums[changeIndices[s]]</code> <strong>等于</strong> <code>0</code> ,<strong>标记</strong> 下标 <code>changeIndices[s]</code> 。</li>
|
||||
<li>什么也不做。</li>
|
||||
</ul>
|
||||
|
||||
<p>请你返回范围 <code>[1, m]</code> 中的一个整数,表示最优操作下,标记 <code>nums</code> 中 <strong>所有</strong> 下标的 <strong>最早秒数</strong> ,如果无法标记所有下标,返回 <code>-1</code> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [2,2,0], changeIndices = [2,2,2,2,3,2,2,1]
|
||||
<b>输出:</b>8
|
||||
<b>解释:</b>这个例子中,我们总共有 8 秒。按照以下操作标记所有下标:
|
||||
第 1 秒:选择下标 1 ,将 nums[1] 减少 1 。nums 变为 [1,2,0] 。
|
||||
第 2 秒:选择下标 1 ,将 nums[1] 减少 1 。nums 变为 [0,2,0] 。
|
||||
第 3 秒:选择下标 2 ,将 nums[2] 减少 1 。nums 变为 [0,1,0] 。
|
||||
第 4 秒:选择下标 2 ,将 nums[2] 减少 1 。nums 变为 [0,0,0] 。
|
||||
第 5 秒,标记 changeIndices[5] ,也就是标记下标 3 ,因为 nums[3] 等于 0 。
|
||||
第 6 秒,标记 changeIndices[6] ,也就是标记下标 2 ,因为 nums[2] 等于 0 。
|
||||
第 7 秒,什么也不做。
|
||||
第 8 秒,标记 changeIndices[8] ,也就是标记下标 1 ,因为 nums[1] 等于 0 。
|
||||
现在所有下标已被标记。
|
||||
最早可以在第 8 秒标记所有下标。
|
||||
所以答案是 8 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [1,3], changeIndices = [1,1,1,2,1,1,1]
|
||||
<b>输出:</b>6
|
||||
<b>解释:</b>这个例子中,我们总共有 7 秒。按照以下操作标记所有下标:
|
||||
第 1 秒:选择下标 2 ,将 nums[2] 减少 1 。nums 变为 [1,2] 。
|
||||
第 2 秒:选择下标 2 ,将 nums[2] 减少 1 。nums 变为 [1,1] 。
|
||||
第 3 秒:选择下标 2 ,将 nums[2] 减少 1 。nums 变为 [1,0] 。
|
||||
第 4 秒:标记 changeIndices[4] ,也就是标记下标 2 ,因为 nums[2] 等于 0 。
|
||||
第 5 秒:选择下标 1 ,将 nums[1] 减少 1 。nums 变为 [0,0] 。
|
||||
第 6 秒:标记 changeIndices[6] ,也就是标记下标 1 ,因为 nums[1] 等于 0 。
|
||||
现在所有下标已被标记。
|
||||
最早可以在第 6 秒标记所有下标。
|
||||
所以答案是 6 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [0,1], changeIndices = [2,2,2]
|
||||
<strong>Output:</strong> -1
|
||||
<strong>Explanation:</strong> 这个例子中,无法标记所有下标,因为下标 1 不在 changeIndices 中。
|
||||
所以答案是 -1 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n == nums.length <= 2000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= m == changeIndices.length <= 2000</code></li>
|
||||
<li><code>1 <= changeIndices[i] <= n</code></li>
|
||||
</ul>
|
@ -0,0 +1,71 @@
|
||||
<p>给你两个下标从 <strong>1</strong> 开始的整数数组 <code>nums</code> 和 <code>changeIndices</code> ,数组的长度分别为 <code>n</code> 和 <code>m</code> 。</p>
|
||||
|
||||
<p>一开始,<code>nums</code> 中所有下标都是未标记的,你的任务是标记 <code>nums</code> 中 <strong>所有</strong> 下标。</p>
|
||||
|
||||
<p>从第 <code>1</code> 秒到第 <code>m</code> 秒(<b>包括 </b>第 <code>m</code> 秒),对于每一秒 <code>s</code> ,你可以执行以下操作 <strong>之一</strong> :</p>
|
||||
|
||||
<ul>
|
||||
<li>选择范围 <code>[1, n]</code> 中的一个下标 <code>i</code> ,并且将 <code>nums[i]</code> <strong>减少</strong> <code>1</code> 。</li>
|
||||
<li>将 <code>nums[changeIndices[s]]</code> 设置成任意的 <strong>非负</strong> 整数。</li>
|
||||
<li>选择范围 <code>[1, n]</code> 中的一个下标 <code>i</code> , 满足 <code>nums[i]</code> <strong>等于</strong> <code>0</code>, 并 <strong>标记</strong> 下标 <code>i</code> 。</li>
|
||||
<li>什么也不做。</li>
|
||||
</ul>
|
||||
|
||||
<p>请你返回范围 <code>[1, m]</code> 中的一个整数,表示最优操作下,标记 <code>nums</code> 中 <strong>所有</strong> 下标的 <strong>最早秒数</strong> ,如果无法标记所有下标,返回 <code>-1</code> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [3,2,3], changeIndices = [1,3,2,2,2,2,3]
|
||||
<b>输出:</b>6
|
||||
<b>解释:</b>这个例子中,我们总共有 7 秒。按照以下操作标记所有下标:
|
||||
第 1 秒:将 nums[changeIndices[1]] 变为 0 。nums 变为 [0,2,3] 。
|
||||
第 2 秒:将 nums[changeIndices[2]] 变为 0 。nums 变为 [0,2,0] 。
|
||||
第 3 秒:将 nums[changeIndices[3]] 变为 0 。nums 变为 [0,0,0] 。
|
||||
第 4 秒:标记下标 1 ,因为 nums[1] 等于 0 。
|
||||
第 5 秒:标记下标 2 ,因为 nums[2] 等于 0 。
|
||||
第 6 秒:标记下标 3 ,因为 nums[3] 等于 0 。
|
||||
现在所有下标已被标记。
|
||||
最早可以在第 6 秒标记所有下标。
|
||||
所以答案是 6 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [0,0,1,2], changeIndices = [1,2,1,2,1,2,1,2]
|
||||
<b>输出:</b>7
|
||||
<b>解释:</b>这个例子中,我们总共有 8 秒。按照以下操作标记所有下标:
|
||||
第 1 秒:标记下标 1 ,因为 nums[1] 等于 0 。
|
||||
第 2 秒:标记下标 2 ,因为 nums[2] 等于 0 。
|
||||
第 3 秒:将 nums[4] 减少 1 。nums 变为 [0,0,1,1] 。
|
||||
第 4 秒:将 nums[4] 减少 1 。nums 变为 [0,0,1,0] 。
|
||||
第 5 秒:将 nums[3] 减少 1 。nums 变为 [0,0,0,0] 。
|
||||
第 6 秒:标记下标 3 ,因为 nums[3] 等于 0 。
|
||||
第 7 秒:标记下标 4 ,因为 nums[4] 等于 0 。
|
||||
现在所有下标已被标记。
|
||||
最早可以在第 7 秒标记所有下标。
|
||||
所以答案是 7 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [1,2,3], changeIndices = [1,2,3]
|
||||
<b>输出:</b>-1
|
||||
<strong>解释:</strong>这个例子中,无法标记所有下标,因为我们没有足够的秒数。
|
||||
所以答案是 -1 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n == nums.length <= 5000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= m == changeIndices.length <= 5000</code></li>
|
||||
<li><code>1 <= changeIndices[i] <= n</code></li>
|
||||
</ul>
|
@ -0,0 +1,50 @@
|
||||
<p>在二维平面上存在 <code>n</code> 个矩形。给你两个下标从 <strong>0</strong> 开始的二维整数数组 <code>bottomLeft</code> 和 <code>topRight</code>,两个数组的大小都是 <code>n x 2</code> ,其中 <code>bottomLeft[i]</code> 和 <code>topRight[i]</code> 分别代表第 <code>i</code> 个矩形的<strong> 左下角 </strong>和 <strong>右上角 </strong>坐标。</p>
|
||||
|
||||
<p>我们定义 <strong>向右 </strong>的方向为 x 轴正半轴(<strong>x 坐标增加</strong>),<strong>向左 </strong>的方向为 x 轴负半轴(<strong>x 坐标减少</strong>)。同样地,定义 <strong>向上 </strong>的方向为 y 轴正半轴(<strong>y 坐标增加</strong>)<strong>,向下 </strong>的方向为 y 轴负半轴(<strong>y 坐标减少</strong>)。</p>
|
||||
|
||||
<p>你可以选择一个区域,该区域由两个矩形的 <strong>交集</strong> 形成。你需要找出能够放入该区域 <strong>内 </strong>的<strong> 最大 </strong>正方形面积,并选择最优解。</p>
|
||||
|
||||
<p>返回能够放入交集区域的正方形的 <strong>最大 </strong>可能面积,如果矩形之间不存在任何交集区域,则返回 <code>0</code>。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="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>输入:</strong>bottomLeft = [[1,1],[2,2],[3,1]], topRight = [[3,3],[4,4],[6,6]]
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>边长为 1 的正方形可以放入矩形 0 和矩形 1 的交集区域,或矩形 1 和矩形 2 的交集区域。因此最大面积是边长 * 边长,即 1 * 1 = 1。
|
||||
可以证明,边长更大的正方形无法放入任何交集区域。
|
||||
</pre>
|
||||
|
||||
<p><strong class="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>输入:</strong>bottomLeft = [[1,1],[2,2],[1,2]], topRight = [[3,3],[4,4],[3,4]]
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>边长为 1 的正方形可以放入矩形 0 和矩形 1,矩形 1 和矩形 2,或所有三个矩形的交集区域。因此最大面积是边长 * 边长,即 1 * 1 = 1。
|
||||
可以证明,边长更大的正方形无法放入任何交集区域。
|
||||
请注意,区域可以由多于两个矩形的交集构成。
|
||||
</pre>
|
||||
|
||||
<p><strong class="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>输入:</strong>bottomLeft = [[1,1],[3,3],[3,1]], topRight = [[2,2],[4,4],[4,2]]
|
||||
<strong>输出:</strong>0
|
||||
<strong>解释:</strong>不存在相交的矩形,因此,返回 0 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>n == bottomLeft.length == topRight.length</code></li>
|
||||
<li><code>2 <= n <= 10<sup>3</sup></code></li>
|
||||
<li><code>bottomLeft[i].length == topRight[i].length == 2</code></li>
|
||||
<li><code>1 <= bottomLeft[i][0], bottomLeft[i][1] <= 10<sup>7</sup></code></li>
|
||||
<li><code>1 <= topRight[i][0], topRight[i][1] <= 10<sup>7</sup></code></li>
|
||||
<li><code>bottomLeft[i][0] < topRight[i][0]</code></li>
|
||||
<li><code>bottomLeft[i][1] < topRight[i][1]</code></li>
|
||||
</ul>
|
@ -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> </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> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 100</code></li>
|
||||
<li><code>nums.length % 2 == 0 </code></li>
|
||||
<li><code>1 <= nums[i] <= 100</code></li>
|
||||
</ul>
|
@ -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> </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't in changeIndices.
|
||||
Hence, the answer is -1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n == nums.length <= 2000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= m == changeIndices.length <= 2000</code></li>
|
||||
<li><code>1 <= changeIndices[i] <= n</code></li>
|
||||
</ul>
|
@ -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> </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't have enough seconds.
|
||||
Hence, the answer is -1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n == nums.length <= 5000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= m == changeIndices.length <= 5000</code></li>
|
||||
<li><code>1 <= changeIndices[i] <= n</code></li>
|
||||
</ul>
|
@ -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 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> </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> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>n == bottomLeft.length == topRight.length</code></li>
|
||||
<li><code>2 <= n <= 10<sup>3</sup></code></li>
|
||||
<li><code>bottomLeft[i].length == topRight[i].length == 2</code></li>
|
||||
<li><code>1 <= bottomLeft[i][0], bottomLeft[i][1] <= 10<sup>7</sup></code></li>
|
||||
<li><code>1 <= topRight[i][0], topRight[i][1] <= 10<sup>7</sup></code></li>
|
||||
<li><code>bottomLeft[i][0] < topRight[i][0]</code></li>
|
||||
<li><code>bottomLeft[i][1] < topRight[i][1]</code></li>
|
||||
</ul>
|
File diff suppressed because it is too large
Load Diff
53
leetcode/originData/[no content]binary-tree-nodes.json
Normal file
53
leetcode/originData/[no content]binary-tree-nodes.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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
45
leetcode/originData/[no content]linked-list-frequency.json
Normal file
45
leetcode/originData/[no content]linked-list-frequency.json
Normal file
File diff suppressed because one or more lines are too long
56
leetcode/originData/[no content]maximize-items.json
Normal file
56
leetcode/originData/[no content]maximize-items.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
59
leetcode/originData/[no content]snaps-analysis.json
Normal file
59
leetcode/originData/[no content]snaps-analysis.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
60
leetcode/originData/[no content]top-percentile-fraud.json
Normal file
60
leetcode/originData/[no content]top-percentile-fraud.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
@ -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
176
leetcode/originData/earliest-second-to-mark-indices-i.json
Normal file
176
leetcode/originData/earliest-second-to-mark-indices-i.json
Normal file
File diff suppressed because one or more lines are too long
185
leetcode/originData/earliest-second-to-mark-indices-ii.json
Normal file
185
leetcode/originData/earliest-second-to-mark-indices-ii.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
179
leetcode/originData/split-the-array.json
Normal file
179
leetcode/originData/split-the-array.json
Normal file
File diff suppressed because one or more lines are too long
69
leetcode/problem/earliest-second-to-mark-indices-i.html
Normal file
69
leetcode/problem/earliest-second-to-mark-indices-i.html
Normal 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> </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't in changeIndices.
|
||||
Hence, the answer is -1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n == nums.length <= 2000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= m == changeIndices.length <= 2000</code></li>
|
||||
<li><code>1 <= changeIndices[i] <= n</code></li>
|
||||
</ul>
|
69
leetcode/problem/earliest-second-to-mark-indices-ii.html
Normal file
69
leetcode/problem/earliest-second-to-mark-indices-ii.html
Normal 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> </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't have enough seconds.
|
||||
Hence, the answer is -1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= n == nums.length <= 5000</code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>9</sup></code></li>
|
||||
<li><code>1 <= m == changeIndices.length <= 5000</code></li>
|
||||
<li><code>1 <= changeIndices[i] <= n</code></li>
|
||||
</ul>
|
@ -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 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> </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> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>n == bottomLeft.length == topRight.length</code></li>
|
||||
<li><code>2 <= n <= 10<sup>3</sup></code></li>
|
||||
<li><code>bottomLeft[i].length == topRight[i].length == 2</code></li>
|
||||
<li><code>1 <= bottomLeft[i][0], bottomLeft[i][1] <= 10<sup>7</sup></code></li>
|
||||
<li><code>1 <= topRight[i][0], topRight[i][1] <= 10<sup>7</sup></code></li>
|
||||
<li><code>bottomLeft[i][0] < topRight[i][0]</code></li>
|
||||
<li><code>bottomLeft[i][1] < topRight[i][1]</code></li>
|
||||
</ul>
|
35
leetcode/problem/split-the-array.html
Normal file
35
leetcode/problem/split-the-array.html
Normal 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> </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> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 100</code></li>
|
||||
<li><code>nums.length % 2 == 0 </code></li>
|
||||
<li><code>1 <= nums[i] <= 100</code></li>
|
||||
</ul>
|
Loading…
Reference in New Issue
Block a user