mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-10-19 20:16:48 +08:00
update
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3282",
|
||||
"questionFrontendId": "2985",
|
||||
"boundTopicId": null,
|
||||
"title": "Calculate Compressed Mean",
|
||||
"titleSlug": "calculate-compressed-mean",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 3,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Orders\":[\"order_id\",\"item_count\",\"order_occurrences\"]},\"rows\":{\"Orders\":[[10,1,500],[11,2,1000],[12,3,800],[13,4,1000]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"275\", \"totalSubmission\": \"311\", \"totalAcceptedRaw\": 275, \"totalSubmissionRaw\": 311, \"acRate\": \"88.4%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Orders\":[\"order_id\",\"item_count\",\"order_occurrences\"]},\"rows\":{\"Orders\":[[10,1,500],[11,2,1000],[12,3,800],[13,4,1000]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if Not Exists Orders ( order_id int, item_count int, order_occurrences int)\"], \"mssql\": [\"Create Table Orders ( order_id int, item_count int, order_occurrences int)\"], \"oraclesql\": [\"Create Table Orders ( order_id int, item_count int, order_occurrences int)\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Orders\": {\"order_id\": \"INT\", \"item_count\": \"INT\", \"order_occurrences\": \"INT\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if Not Exists Orders ( order_id int, item_count int, order_occurrences int)",
|
||||
"Truncate table Orders",
|
||||
"insert into Orders (order_id, item_count, order_occurrences) values ('10', '1', '500')",
|
||||
"insert into Orders (order_id, item_count, order_occurrences) values ('11', '2', '1000')",
|
||||
"insert into Orders (order_id, item_count, order_occurrences) values ('12', '3', '800')",
|
||||
"insert into Orders (order_id, item_count, order_occurrences) values ('13', '4', '1000')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
59
leetcode/originData/[no content]class-performance.json
Normal file
59
leetcode/originData/[no content]class-performance.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3286",
|
||||
"questionFrontendId": "2989",
|
||||
"boundTopicId": null,
|
||||
"title": "Class Performance",
|
||||
"titleSlug": "class-performance",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 3,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Scores\":[\"student_id\",\"student_name\",\"assignment1\",\"assignment2\",\"assignment3\"]},\"rows\":{\"Scores\":[[309,\"Owen\",88,47,87],[321,\"Claire\",98,95,37],[338,\"Julian\",100,64,43],[423,\"Peyton\",60,44,47],[896,\"David\",32,37,50],[235,\"Camila\",31,53,69]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"284\", \"totalSubmission\": \"305\", \"totalAcceptedRaw\": 284, \"totalSubmissionRaw\": 305, \"acRate\": \"93.1%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Scores\":[\"student_id\",\"student_name\",\"assignment1\",\"assignment2\",\"assignment3\"]},\"rows\":{\"Scores\":[[309,\"Owen\",88,47,87],[321,\"Claire\",98,95,37],[338,\"Julian\",100,64,43],[423,\"Peyton\",60,44,47],[896,\"David\",32,37,50],[235,\"Camila\",31,53,69]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if Not Exists Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)\"], \"mssql\": [\"Create Table Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)\"], \"oraclesql\": [\"Create Table Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Scores\": {\"student_id\": \"INT\", \"student_name\": \"VARCHAR(40)\", \"assignment1\": \"INT\", \"assignment2\": \"INT\", \"assignment3\": \"INT\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if Not Exists Scores (student_id int, student_name varchar(40), assignment1 int,assignment2 int, assignment3 int)",
|
||||
"Truncate table Scores",
|
||||
"insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('309', 'Owen', '88', '47', '87')",
|
||||
"insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('321', 'Claire', '98', '95', '37')",
|
||||
"insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('338', 'Julian', '100', '64', '43')",
|
||||
"insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('423', 'Peyton', '60', '44', '47')",
|
||||
"insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('896', 'David', '32', '37', '50')",
|
||||
"insert into Scores (student_id, student_name, assignment1, assignment2, assignment3) values ('235', 'Camila', '31', '53', '69')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
64
leetcode/originData/[no content]find-expensive-cities.json
Normal file
64
leetcode/originData/[no content]find-expensive-cities.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3284",
|
||||
"questionFrontendId": "2987",
|
||||
"boundTopicId": null,
|
||||
"title": "Find Expensive Cities",
|
||||
"titleSlug": "find-expensive-cities",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 3,
|
||||
"dislikes": 2,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Listings\":[\"listing_id\",\"city\",\"price\"]},\"rows\":{\"Listings\":[[113,\"LosAngeles\",7560386],[136,\"SanFrancisco\",2380268],[92,\"Chicago\",9833209],[60,\"Chicago\",5147582],[8,\"Chicago\",5274441],[79,\"SanFrancisco\",8372065],[37,\"Chicago\",7939595],[53,\"LosAngeles\",4965123],[178,\"SanFrancisco\",999207],[51,\"NewYork\",5951718],[121,\"NewYork\",2893760]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"305\", \"totalSubmission\": \"364\", \"totalAcceptedRaw\": 305, \"totalSubmissionRaw\": 364, \"acRate\": \"83.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Listings\":[\"listing_id\",\"city\",\"price\"]},\"rows\":{\"Listings\":[[113,\"LosAngeles\",7560386],[136,\"SanFrancisco\",2380268],[92,\"Chicago\",9833209],[60,\"Chicago\",5147582],[8,\"Chicago\",5274441],[79,\"SanFrancisco\",8372065],[37,\"Chicago\",7939595],[53,\"LosAngeles\",4965123],[178,\"SanFrancisco\",999207],[51,\"NewYork\",5951718],[121,\"NewYork\",2893760]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if Not Exists Listings (listing_id int, city varchar(50), price int)\"], \"mssql\": [\"Create Table Listings (listing_id int, city varchar(50), price int)\"], \"oraclesql\": [\"Create Table Listings (listing_id int, city varchar(50), price int)\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Listings\": {\"listing_id\": \"INT\", \"city\": \"VARCHAR(50)\", \"price\": \"INT\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if Not Exists Listings (listing_id int, city varchar(50), price int)",
|
||||
"Truncate table Listings",
|
||||
"insert into Listings (listing_id, city, price) values ('113', 'LosAngeles', '7560386')",
|
||||
"insert into Listings (listing_id, city, price) values ('136', 'SanFrancisco', '2380268')",
|
||||
"insert into Listings (listing_id, city, price) values ('92', 'Chicago', '9833209')",
|
||||
"insert into Listings (listing_id, city, price) values ('60', 'Chicago', '5147582')",
|
||||
"insert into Listings (listing_id, city, price) values ('8', 'Chicago', '5274441')",
|
||||
"insert into Listings (listing_id, city, price) values ('79', 'SanFrancisco', '8372065')",
|
||||
"insert into Listings (listing_id, city, price) values ('37', 'Chicago', '7939595')",
|
||||
"insert into Listings (listing_id, city, price) values ('53', 'LosAngeles', '4965123')",
|
||||
"insert into Listings (listing_id, city, price) values ('178', 'SanFrancisco', '999207')",
|
||||
"insert into Listings (listing_id, city, price) values ('51', 'NewYork', '5951718')",
|
||||
"insert into Listings (listing_id, city, price) values ('121', 'NewYork', '2893760')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3281",
|
||||
"questionFrontendId": "2984",
|
||||
"boundTopicId": null,
|
||||
"title": "Find Peak Calling Hours for Each City",
|
||||
"titleSlug": "find-peak-calling-hours-for-each-city",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 2,
|
||||
"dislikes": 2,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Calls\":[\"caller_id\",\"recipient_id\",\"call_time\",\"city\"]},\"rows\":{\"Calls\":[[8,4,\"2021-08-24 22:46:07\",\"Houston\"],[4,8,\"2021-08-24 22:57:13\",\"Houston\"],[5,1,\"2021-08-11 21:28:44\",\"Houston\"],[8,3,\"2021-08-17 22:04:15\",\"Houston\"],[11,3,\"2021-08-17 13:07:00\",\"New York\"],[8,11,\"2021-08-17 14:22:22\",\"New York\"]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"205\", \"totalSubmission\": \"308\", \"totalAcceptedRaw\": 205, \"totalSubmissionRaw\": 308, \"acRate\": \"66.6%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Calls\":[\"caller_id\",\"recipient_id\",\"call_time\",\"city\"]},\"rows\":{\"Calls\":[[8,4,\"2021-08-24 22:46:07\",\"Houston\"],[4,8,\"2021-08-24 22:57:13\",\"Houston\"],[5,1,\"2021-08-11 21:28:44\",\"Houston\"],[8,3,\"2021-08-17 22:04:15\",\"Houston\"],[11,3,\"2021-08-17 13:07:00\",\"New York\"],[8,11,\"2021-08-17 14:22:22\",\"New York\"]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create table If Not Exists Calls (caller_id int, recipient_id int, call_time datetime, city varchar(40))\"], \"mssql\": [\"Create table Calls (caller_id int, recipient_id int, call_time datetime, city varchar(40))\"], \"oraclesql\": [\"Create table Calls (caller_id int, recipient_id int, call_time date, city varchar(40))\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Calls\": {\"caller_id\": \"INT\", \"recipient_id\": \"INT\", \"call_time\": \"DATETIME\", \"city\": \"VARCHAR(40)\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create table If Not Exists Calls (caller_id int, recipient_id int, call_time datetime, city varchar(40))",
|
||||
"Truncate table Calls",
|
||||
"insert into Calls (caller_id, recipient_id, call_time, city) values ('8', '4', '2021-08-24 22:46:07', 'Houston')",
|
||||
"insert into Calls (caller_id, recipient_id, call_time, city) values ('4', '8', '2021-08-24 22:57:13', 'Houston')",
|
||||
"insert into Calls (caller_id, recipient_id, call_time, city) values ('5', '1', '2021-08-11 21:28:44', 'Houston')",
|
||||
"insert into Calls (caller_id, recipient_id, call_time, city) values ('8', '3', '2021-08-17 22:04:15', 'Houston')",
|
||||
"insert into Calls (caller_id, recipient_id, call_time, city) values ('11', '3', '2021-08-17 13:07:00', 'New York')",
|
||||
"insert into Calls (caller_id, recipient_id, call_time, city) values ('8', '11', '2021-08-17 14:22:22', 'New York')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
62
leetcode/originData/[no content]find-third-transaction.json
Normal file
62
leetcode/originData/[no content]find-third-transaction.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3283",
|
||||
"questionFrontendId": "2986",
|
||||
"boundTopicId": null,
|
||||
"title": "Find Third Transaction",
|
||||
"titleSlug": "find-third-transaction",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 2,
|
||||
"dislikes": 2,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Transactions\":[\"user_id\",\"spend\",\"transaction_date\"]},\"rows\":{\"Transactions\":[[1,65.56,\"2023-11-18 13:49:42\"],[1,96.0,\"2023-11-30 02:47:26\"],[1,7.44,\"2023-11-02 12:15:23\"],[1,49.78,\"2023-11-12 00:13:46\"],[2,40.89,\"2023-11-21 04:39:15\"],[2,100.44,\"2023-11-20 07:39:34\"],[3,37.33,\"2023-11-03 06:22:02\"],[3,13.89,\"2023-11-11 16:00:14\"],[3,7.0,\"2023-11-29 22:32:36\"]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"185\", \"totalSubmission\": \"378\", \"totalAcceptedRaw\": 185, \"totalSubmissionRaw\": 378, \"acRate\": \"48.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Transactions\":[\"user_id\",\"spend\",\"transaction_date\"]},\"rows\":{\"Transactions\":[[1,65.56,\"2023-11-18 13:49:42\"],[1,96.0,\"2023-11-30 02:47:26\"],[1,7.44,\"2023-11-02 12:15:23\"],[1,49.78,\"2023-11-12 00:13:46\"],[2,40.89,\"2023-11-21 04:39:15\"],[2,100.44,\"2023-11-20 07:39:34\"],[3,37.33,\"2023-11-03 06:22:02\"],[3,13.89,\"2023-11-11 16:00:14\"],[3,7.0,\"2023-11-29 22:32:36\"]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if Not Exists Transactions (user_id int, spend decimal(5,2), transaction_date datetime) \"], \"mssql\": [\"Create Table Transactions (user_id int, spend decimal(5,2), transaction_date datetime) \"], \"oraclesql\": [\"Create Table Transactions (user_id int, spend decimal(5,2), transaction_date date) \", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Transactions\": {\"user_id\": \"INT\", \"spend\": \"DECIMAL(5, 2)\", \"transaction_date\": \"DATETIME\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if Not Exists Transactions (user_id int, spend decimal(5,2), transaction_date datetime) ",
|
||||
"Truncate table Transactions",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('1', '65.56', '2023-11-18 13:49:42')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('1', '96.0', '2023-11-30 02:47:26')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('1', '7.44', '2023-11-02 12:15:23')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('1', '49.78', '2023-11-12 00:13:46')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('2', '40.89', '2023-11-21 04:39:15')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('2', '100.44', '2023-11-20 07:39:34')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('3', '37.33', '2023-11-03 06:22:02')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('3', '13.89', '2023-11-11 16:00:14')",
|
||||
"insert into Transactions (user_id, spend, transaction_date) values ('3', '7.0', '2023-11-29 22:32:36')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
61
leetcode/originData/[no content]friday-purchases-i.json
Normal file
61
leetcode/originData/[no content]friday-purchases-i.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3300",
|
||||
"questionFrontendId": "2993",
|
||||
"boundTopicId": null,
|
||||
"title": "Friday Purchases I",
|
||||
"titleSlug": "friday-purchases-i",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 4,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Purchases\":[\"user_id\",\"purchase_date\",\"amount_spend\"]},\"rows\":{\"Purchases\":[[11,\"2023-11-07\",1126],[15,\"2023-11-30\",7473],[17,\"2023-11-14\",2414],[12,\"2023-11-24\",9692],[8,\"2023-11-03\",5117],[1,\"2023-11-16\",5241],[10,\"2023-11-12\",8266],[13,\"2023-11-24\",12000]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"182\", \"totalSubmission\": \"210\", \"totalAcceptedRaw\": 182, \"totalSubmissionRaw\": 210, \"acRate\": \"86.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Purchases\":[\"user_id\",\"purchase_date\",\"amount_spend\"]},\"rows\":{\"Purchases\":[[11,\"2023-11-07\",1126],[15,\"2023-11-30\",7473],[17,\"2023-11-14\",2414],[12,\"2023-11-24\",9692],[8,\"2023-11-03\",5117],[1,\"2023-11-16\",5241],[10,\"2023-11-12\",8266],[13,\"2023-11-24\",12000]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)\"], \"mssql\": [\"Create Table Purchases( user_id int, purchase_date date, amount_spend int)\"], \"oraclesql\": [\"Create Table Purchases( user_id int, purchase_date date, amount_spend int)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Purchases\": {\"user_id\": \"INT\", \"purchase_date\": \"DATE\", \"amount_spend\": \"INT\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)",
|
||||
"Truncate table Purchases",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('11', '2023-11-07', '1126')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('15', '2023-11-30', '7473')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('17', '2023-11-14', '2414')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('12', '2023-11-24', '9692')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('8', '2023-11-03', '5117')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('1', '2023-11-16', '5241')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('10', '2023-11-12', '8266')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('13', '2023-11-24', '12000')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
61
leetcode/originData/[no content]friday-purchases-ii.json
Normal file
61
leetcode/originData/[no content]friday-purchases-ii.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3301",
|
||||
"questionFrontendId": "2994",
|
||||
"boundTopicId": null,
|
||||
"title": "Friday Purchases II ",
|
||||
"titleSlug": "friday-purchases-ii",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 4,
|
||||
"dislikes": 2,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Purchases\":[\"user_id\",\"purchase_date\",\"amount_spend\"]},\"rows\":{\"Purchases\":[[11,\"2023-11-07\",1126],[15,\"2023-11-30\",7473],[17,\"2023-11-14\",2414],[12,\"2023-11-24\",9692],[8,\"2023-11-03\",5117],[1,\"2023-11-16\",5241],[10,\"2023-11-12\",8266],[13,\"2023-11-24\",12000]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"152\", \"totalSubmission\": \"173\", \"totalAcceptedRaw\": 152, \"totalSubmissionRaw\": 173, \"acRate\": \"87.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Purchases\":[\"user_id\",\"purchase_date\",\"amount_spend\"]},\"rows\":{\"Purchases\":[[11,\"2023-11-07\",1126],[15,\"2023-11-30\",7473],[17,\"2023-11-14\",2414],[12,\"2023-11-24\",9692],[8,\"2023-11-03\",5117],[1,\"2023-11-16\",5241],[10,\"2023-11-12\",8266],[13,\"2023-11-24\",12000]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)\"], \"mssql\": [\"Create Table Purchases( user_id int, purchase_date date, amount_spend int)\"], \"oraclesql\": [\"Create Table Purchases( user_id int, purchase_date date, amount_spend int)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Purchases\": {\"user_id\": \"INT\", \"purchase_date\": \"DATE\", \"amount_spend\": \"INT\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if Not Exists Purchases( user_id int, purchase_date date, amount_spend int)",
|
||||
"Truncate table Purchases",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('11', '2023-11-07', '1126')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('15', '2023-11-30', '7473')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('17', '2023-11-14', '2414')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('12', '2023-11-24', '9692')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('8', '2023-11-03', '5117')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('1', '2023-11-16', '5241')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('10', '2023-11-12', '8266')",
|
||||
"insert into Purchases (user_id, purchase_date, amount_spend) values ('13', '2023-11-24', '12000')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
61
leetcode/originData/[no content]loan-types.json
Normal file
61
leetcode/originData/[no content]loan-types.json
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3287",
|
||||
"questionFrontendId": "2990",
|
||||
"boundTopicId": null,
|
||||
"title": "Loan Types",
|
||||
"titleSlug": "loan-types",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 4,
|
||||
"dislikes": 5,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Loans\":[\"loan_id\",\"user_id\",\"loan_type\"]},\"rows\":{\"Loans\":[[683,101,\"Mortgage\"],[218,101,\"AutoLoan\"],[802,101,\"Inschool\"],[593,102,\"Mortgage\"],[138,102,\"Refinance\"],[294,102,\"Inschool\"],[308,103,\"Refinance\"],[389,104,\"Mortgage\"]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"311\", \"totalSubmission\": \"456\", \"totalAcceptedRaw\": 311, \"totalSubmissionRaw\": 456, \"acRate\": \"68.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Loans\":[\"loan_id\",\"user_id\",\"loan_type\"]},\"rows\":{\"Loans\":[[683,101,\"Mortgage\"],[218,101,\"AutoLoan\"],[802,101,\"Inschool\"],[593,102,\"Mortgage\"],[138,102,\"Refinance\"],[294,102,\"Inschool\"],[308,103,\"Refinance\"],[389,104,\"Mortgage\"]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create Table if not Exists Loans ( loan_id int, user_id int, loan_type varchar(40))\"], \"mssql\": [\"Create Table Loans (loan_id int, user_id int, loan_type varchar(40))\"], \"oraclesql\": [\"Create Table Loans ( loan_id int, user_id int, loan_type varchar(40))\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Loans\": {\"loan_id\": \"INT\", \"user_id\": \"INT\", \"loan_type\": \"VARCHAR(40)\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create Table if not Exists Loans ( loan_id int, user_id int, loan_type varchar(40))",
|
||||
"Truncate table Loans",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('683', '101', 'Mortgage')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('218', '101', 'AutoLoan')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('802', '101', 'Inschool')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('593', '102', 'Mortgage')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('138', '102', 'Refinance')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('294', '102', 'Inschool')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('308', '103', 'Refinance')",
|
||||
"insert into Loans (loan_id, user_id, loan_type) values ('389', '104', 'Mortgage')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3285",
|
||||
"questionFrontendId": "2988",
|
||||
"boundTopicId": null,
|
||||
"title": "Manager of the Largest Department",
|
||||
"titleSlug": "manager-of-the-largest-department",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 1,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Employees\":[\"emp_id\",\"emp_name\",\"dep_id\",\"position\"]},\"rows\":{\"Employees\":[[156,\"Michael\",107,\"Manager\"],[112,\"Lucas\",107,\"Consultant\"],[8,\"Isabella\",101,\"Manager\"],[160,\"Joseph\",100,\"Manager\"],[80,\"Aiden\",100,\"Engineer\"],[190,\"Skylar\",100,\"Freelancer\"],[196,\"Stella\",101,\"Coordinator\"],[167,\"Audrey\",100,\"Consultant\"],[97,\"Nathan\",101,\"Supervisor\"],[128,\"Ian\",101,\"Administrator\"],[81,\"Ethan\",107,\"Administrator\"]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"257\", \"totalSubmission\": \"310\", \"totalAcceptedRaw\": 257, \"totalSubmissionRaw\": 310, \"acRate\": \"82.9%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Employees\":[\"emp_id\",\"emp_name\",\"dep_id\",\"position\"]},\"rows\":{\"Employees\":[[156,\"Michael\",107,\"Manager\"],[112,\"Lucas\",107,\"Consultant\"],[8,\"Isabella\",101,\"Manager\"],[160,\"Joseph\",100,\"Manager\"],[80,\"Aiden\",100,\"Engineer\"],[190,\"Skylar\",100,\"Freelancer\"],[196,\"Stella\",101,\"Coordinator\"],[167,\"Audrey\",100,\"Consultant\"],[97,\"Nathan\",101,\"Supervisor\"],[128,\"Ian\",101,\"Administrator\"],[81,\"Ethan\",107,\"Administrator\"]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create table if not exists Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))\"], \"mssql\": [\"Create table Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))\"], \"oraclesql\": [\"Create table Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Employees\": {\"emp_id\": \"INT\", \"emp_name\": \"VARCHAR(50)\", \"dep_id\": \"INT\", \"position\": \"VARCHAR(30)\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create table if not exists Employees ( emp_id int, emp_name varchar(50), dep_id int, position varchar(30))",
|
||||
"Truncate table Employees",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('156', 'Michael', '107', 'Manager')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('112', 'Lucas', '107', 'Consultant')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('8', 'Isabella', '101', 'Manager')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('160', 'Joseph', '100', 'Manager')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('80', 'Aiden', '100', 'Engineer')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('190', 'Skylar', '100', 'Freelancer')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('196', 'Stella', '101', 'Coordinator')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('167', 'Audrey', '100', 'Consultant')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('97', 'Nathan', '101', 'Supervisor')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('128', 'Ian', '101', 'Administrator')",
|
||||
"insert into Employees (emp_id, emp_name, dep_id, position) values ('81', 'Ethan', '107', 'Administrator')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
62
leetcode/originData/[no content]top-three-wineries.json
Normal file
62
leetcode/originData/[no content]top-three-wineries.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3288",
|
||||
"questionFrontendId": "2991",
|
||||
"boundTopicId": null,
|
||||
"title": "Top Three Wineries ",
|
||||
"titleSlug": "top-three-wineries",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 2,
|
||||
"dislikes": 3,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Wineries\":[\"id\",\"country\",\"points\",\"winery\"]},\"rows\":{\"Wineries\":[[103,\"Australia\",84,\"WhisperingPines\"],[737,\"Australia\",85,\"GrapesGalore\"],[848,\"Australia\",100,\"HarmonyHill\"],[222,\"Hungary\",60,\"MoonlitCellars\"],[116,\"USA\",47,\"RoyalVines\"],[124,\"USA\",45,\"Eagle'sNest\"],[648,\"India\",69,\"SunsetVines\"],[894,\"USA\",39,\"RoyalVines\"],[677,\"USA\",9,\"PacificCrest\"]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"230\", \"totalSubmission\": \"405\", \"totalAcceptedRaw\": 230, \"totalSubmissionRaw\": 405, \"acRate\": \"56.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Wineries\":[\"id\",\"country\",\"points\",\"winery\"]},\"rows\":{\"Wineries\":[[103,\"Australia\",84,\"WhisperingPines\"],[737,\"Australia\",85,\"GrapesGalore\"],[848,\"Australia\",100,\"HarmonyHill\"],[222,\"Hungary\",60,\"MoonlitCellars\"],[116,\"USA\",47,\"RoyalVines\"],[124,\"USA\",45,\"Eagle'sNest\"],[648,\"India\",69,\"SunsetVines\"],[894,\"USA\",39,\"RoyalVines\"],[677,\"USA\",9,\"PacificCrest\"]]}}",
|
||||
"metaData": "{\"mysql\": [\"Create table if Not Exists Wineries ( id int, country varchar(60), points int, winery varchar(60))\"], \"mssql\": [\"Create table Wineries ( id int, country varchar(60), points int, winery varchar(60))\"], \"oraclesql\": [\"Create table Wineries ( id int, country varchar(60), points int, winery varchar(60))\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Wineries\": {\"id\": \"INT\", \"country\": \"VARCHAR(60)\", \"points\": \"INT\", \"winery\": \"VARCHAR(60)\"}}}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create table if Not Exists Wineries ( id int, country varchar(60), points int, winery varchar(60))",
|
||||
"Truncate table Wineries",
|
||||
"insert into Wineries (id, country, points, winery) values ('103', 'Australia', '84', 'WhisperingPines')",
|
||||
"insert into Wineries (id, country, points, winery) values ('737', 'Australia', '85', 'GrapesGalore')",
|
||||
"insert into Wineries (id, country, points, winery) values ('848', 'Australia', '100', 'HarmonyHill')",
|
||||
"insert into Wineries (id, country, points, winery) values ('222', 'Hungary', '60', 'MoonlitCellars')",
|
||||
"insert into Wineries (id, country, points, winery) values ('116', 'USA', '47', 'RoyalVines')",
|
||||
"insert into Wineries (id, country, points, winery) values ('124', 'USA', '45', 'Eagle'sNest')",
|
||||
"insert into Wineries (id, country, points, winery) values ('648', 'India', '69', 'SunsetVines')",
|
||||
"insert into Wineries (id, country, points, winery) values ('894', 'USA', '39', 'RoyalVines')",
|
||||
"insert into Wineries (id, country, points, winery) values ('677', 'USA', '9', 'PacificCrest')"
|
||||
],
|
||||
"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>\"]}",
|
||||
"libraryUrl": null,
|
||||
"adminUrl": null,
|
||||
"challengeQuestion": null,
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3302",
|
||||
"questionFrontendId": "2995",
|
||||
"boundTopicId": null,
|
||||
"title": "Viewers Turned Streamers",
|
||||
"titleSlug": "viewers-turned-streamers",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "{\"headers\":{\"Sessions\":[\"user_id\",\"session_start\",\"session_end\",\"session_id\",\"session_type\"]},\"rows\":{\"Sessions\":[[101,\"2023-11-06 13:53:42\",\"2023-11-06 14:05:42\",375,\"Viewer\"],[101,\"2023-11-22 16:45:21\",\"2023-11-22 20:39:21\",594,\"Streamer\"],[102,\"2023-11-16 13:23:09\",\"2023-11-16 16:10:09\",777,\"Streamer\"],[102,\"2023-11-17 13:23:09\",\"2023-11-17 16:10:09\",778,\"Streamer\"],[101,\"2023-11-20 07:16:06\",\"2023-11-20 08:33:06\",315,\"Streamer\"],[104,\"2023-11-27 03:10:49\",\"2023-11-27 03:30:49\",797,\"Viewer\"],[103,\"2023-11-27 03:10:49\",\"2023-11-27 03:30:49\",798,\"Streamer\"]]}}",
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"130\", \"totalSubmission\": \"246\", \"totalAcceptedRaw\": 130, \"totalSubmissionRaw\": 246, \"acRate\": \"52.8%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Sessions\":[\"user_id\",\"session_start\",\"session_end\",\"session_id\",\"session_type\"]},\"rows\":{\"Sessions\":[[101,\"2023-11-06 13:53:42\",\"2023-11-06 14:05:42\",375,\"Viewer\"],[101,\"2023-11-22 16:45:21\",\"2023-11-22 20:39:21\",594,\"Streamer\"],[102,\"2023-11-16 13:23:09\",\"2023-11-16 16:10:09\",777,\"Streamer\"],[102,\"2023-11-17 13:23:09\",\"2023-11-17 16:10:09\",778,\"Streamer\"],[101,\"2023-11-20 07:16:06\",\"2023-11-20 08:33:06\",315,\"Streamer\"],[104,\"2023-11-27 03:10:49\",\"2023-11-27 03:30:49\",797,\"Viewer\"],[103,\"2023-11-27 03:10:49\",\"2023-11-27 03:30:49\",798,\"Streamer\"]]}}",
|
||||
"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\": \"count_turned_streamers\", \"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\"], \"postgresql\": [\"Create table If Not Exists Sessions (user_id int, session_start timestamp, session_end timestamp, session_id int, session_type VARCHAR(50) CHECK (session_type IN ('Viewer','Streamer')))\\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-06 13:53:42', '2023-11-06 14:05:42', '375', 'Viewer')",
|
||||
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-22 16:45:21', '2023-11-22 20:39:21', '594', 'Streamer')",
|
||||
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('102', '2023-11-16 13:23:09', '2023-11-16 16:10:09', '777', 'Streamer')",
|
||||
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('102', '2023-11-17 13:23:09', '2023-11-17 16:10:09', '778', 'Streamer')",
|
||||
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('101', '2023-11-20 07:16:06', '2023-11-20 08:33:06', '315', 'Streamer')",
|
||||
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('104', '2023-11-27 03:10:49', '2023-11-27 03:30:49', '797', 'Viewer')",
|
||||
"insert into Sessions (user_id, session_start, session_end, session_id, session_type) values ('103', '2023-11-27 03:10:49', '2023-11-27 03:30:49', '798', 'Streamer')"
|
||||
],
|
||||
"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"
|
||||
}
|
||||
}
|
||||
}
|
175
leetcode/originData/check-if-bitwise-or-has-trailing-zeros.json
Normal file
175
leetcode/originData/check-if-bitwise-or-has-trailing-zeros.json
Normal file
File diff suppressed because one or more lines are too long
181
leetcode/originData/count-the-number-of-powerful-integers.json
Normal file
181
leetcode/originData/count-the-number-of-powerful-integers.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
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
181
leetcode/originData/maximum-size-of-a-set-after-removals.json
Normal file
181
leetcode/originData/maximum-size-of-a-set-after-removals.json
Normal file
File diff suppressed because one or more lines are too long
174
leetcode/originData/minimum-moves-to-capture-the-queen.json
Normal file
174
leetcode/originData/minimum-moves-to-capture-the-queen.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
File diff suppressed because one or more lines are too long
185
leetcode/originData/palindrome-rearrangement-queries.json
Normal file
185
leetcode/originData/palindrome-rearrangement-queries.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
41
leetcode/problem/check-if-bitwise-or-has-trailing-zeros.html
Normal file
41
leetcode/problem/check-if-bitwise-or-has-trailing-zeros.html
Normal file
@@ -0,0 +1,41 @@
|
||||
<p>You are given an array of <strong>positive</strong> integers <code>nums</code>.</p>
|
||||
|
||||
<p>You have to check if it is possible to select <strong>two or more</strong> elements in the array such that the bitwise <code>OR</code> of the selected elements has <strong>at least </strong>one trailing zero in its binary representation.</p>
|
||||
|
||||
<p>For example, the binary representation of <code>5</code>, which is <code>"101"</code>, does not have any trailing zeros, whereas the binary representation of <code>4</code>, which is <code>"100"</code>, has two trailing zeros.</p>
|
||||
|
||||
<p>Return <code>true</code> <em>if it is possible to select two or more elements whose bitwise</em> <code>OR</code> <em>has trailing zeros, return</em> <code>false</code> <em>otherwise</em>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [1,2,3,4,5]
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation:</strong> If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation "110" with one trailing zero.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [2,4,8,16]
|
||||
<strong>Output:</strong> true
|
||||
<strong>Explanation: </strong>If we select the elements 2 and 4, their bitwise OR is 6, which has the binary representation "110" with one trailing zero.
|
||||
Other possible ways to select elements to have trailing zeroes in the binary representation of their bitwise OR are: (2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), and (2, 4, 8, 16).
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [1,3,5,7,9]
|
||||
<strong>Output:</strong> false
|
||||
<strong>Explanation:</strong> There is no possible way to select two or more elements to have trailing zeros in the binary representation of their bitwise OR.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>2 <= nums.length <= 100</code></li>
|
||||
<li><code>1 <= nums[i] <= 100</code></li>
|
||||
</ul>
|
45
leetcode/problem/count-the-number-of-powerful-integers.html
Normal file
45
leetcode/problem/count-the-number-of-powerful-integers.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<p>You are given three integers <code>start</code>, <code>finish</code>, and <code>limit</code>. You are also given a <strong>0-indexed</strong> string <code>s</code> representing a <strong>positive</strong> integer.</p>
|
||||
|
||||
<p>A <strong>positive</strong> integer <code>x</code> is called <strong>powerful</strong> if it ends with <code>s</code> (in other words, <code>s</code> is a <strong>suffix</strong> of <code>x</code>) and each digit in <code>x</code> is at most <code>limit</code>.</p>
|
||||
|
||||
<p>Return <em>the <strong>total</strong> number of powerful integers in the range</em> <code>[start..finish]</code>.</p>
|
||||
|
||||
<p>A string <code>x</code> is a suffix of a string <code>y</code> if and only if <code>x</code> is a substring of <code>y</code> that starts from some index (<strong>including </strong><code>0</code>) in <code>y</code> and extends to the index <code>y.length - 1</code>. For example, <code>25</code> is a suffix of <code>5125</code> whereas <code>512</code> is not.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> start = 1, finish = 6000, limit = 4, s = "124"
|
||||
<strong>Output:</strong> 5
|
||||
<strong>Explanation:</strong> The powerful integers in the range [1..6000] are 124, 1124, 2124, 3124, and, 4124. All these integers have each digit <= 4, and "124" as a suffix. Note that 5124 is not a powerful integer because the first digit is 5 which is greater than 4.
|
||||
It can be shown that there are only 5 powerful integers in this range.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> start = 15, finish = 215, limit = 6, s = "10"
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> The powerful integers in the range [15..215] are 110 and 210. All these integers have each digit <= 6, and "10" as a suffix.
|
||||
It can be shown that there are only 2 powerful integers in this range.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> start = 1000, finish = 2000, limit = 4, s = "3000"
|
||||
<strong>Output:</strong> 0
|
||||
<strong>Explanation:</strong> All integers in the range [1000..2000] are smaller than 3000, hence "3000" cannot be a suffix of any integer in this range.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= start <= finish <= 10<sup>15</sup></code></li>
|
||||
<li><code>1 <= limit <= 9</code></li>
|
||||
<li><code>1 <= s.length <= floor(log<sub>10</sub>(finish)) + 1</code></li>
|
||||
<li><code>s</code> only consists of numeric digits which are at most <code>limit</code>.</li>
|
||||
<li><code>s</code> does not have leading zeros.</li>
|
||||
</ul>
|
@@ -0,0 +1,42 @@
|
||||
<p>You are given a string <code>s</code> that consists of lowercase English letters.</p>
|
||||
|
||||
<p>A string is called <strong>special</strong> if it is made up of only a single character. For example, the string <code>"abc"</code> is not special, whereas the strings <code>"ddd"</code>, <code>"zz"</code>, and <code>"f"</code> are special.</p>
|
||||
|
||||
<p>Return <em>the length of the <strong>longest special substring</strong> of </em><code>s</code> <em>which occurs <strong>at least thrice</strong></em>, <em>or </em><code>-1</code><em> if no special substring occurs at least thrice</em>.</p>
|
||||
|
||||
<p>A <strong>substring</strong> is a contiguous <strong>non-empty</strong> sequence of characters within a string.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "aaaa"
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> The longest special substring which occurs thrice is "aa": substrings "<u><strong>aa</strong></u>aa", "a<u><strong>aa</strong></u>a", and "aa<u><strong>aa</strong></u>".
|
||||
It can be shown that the maximum length achievable is 2.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abcdef"
|
||||
<strong>Output:</strong> -1
|
||||
<strong>Explanation:</strong> There exists no special substring which occurs at least thrice. Hence return -1.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abcaba"
|
||||
<strong>Output:</strong> 1
|
||||
<strong>Explanation:</strong> The longest special substring which occurs thrice is "a": substrings "<u><strong>a</strong></u>bcaba", "abc<u><strong>a</strong></u>ba", and "abcab<u><strong>a</strong></u>".
|
||||
It can be shown that the maximum length achievable is 1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>3 <= s.length <= 50</code></li>
|
||||
<li><code>s</code> consists of only lowercase English letters.</li>
|
||||
</ul>
|
@@ -0,0 +1,42 @@
|
||||
<p>You are given a string <code>s</code> that consists of lowercase English letters.</p>
|
||||
|
||||
<p>A string is called <strong>special</strong> if it is made up of only a single character. For example, the string <code>"abc"</code> is not special, whereas the strings <code>"ddd"</code>, <code>"zz"</code>, and <code>"f"</code> are special.</p>
|
||||
|
||||
<p>Return <em>the length of the <strong>longest special substring</strong> of </em><code>s</code> <em>which occurs <strong>at least thrice</strong></em>, <em>or </em><code>-1</code><em> if no special substring occurs at least thrice</em>.</p>
|
||||
|
||||
<p>A <strong>substring</strong> is a contiguous <strong>non-empty</strong> sequence of characters within a string.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "aaaa"
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> The longest special substring which occurs thrice is "aa": substrings "<u><strong>aa</strong></u>aa", "a<u><strong>aa</strong></u>a", and "aa<u><strong>aa</strong></u>".
|
||||
It can be shown that the maximum length achievable is 2.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abcdef"
|
||||
<strong>Output:</strong> -1
|
||||
<strong>Explanation:</strong> There exists no special substring which occurs at least thrice. Hence return -1.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abcaba"
|
||||
<strong>Output:</strong> 1
|
||||
<strong>Explanation:</strong> The longest special substring which occurs thrice is "a": substrings "<u><strong>a</strong></u>bcaba", "abc<u><strong>a</strong></u>ba", and "abcab<u><strong>a</strong></u>".
|
||||
It can be shown that the maximum length achievable is 1.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>3 <= s.length <= 5 * 10<sup>5</sup></code></li>
|
||||
<li><code>s</code> consists of only lowercase English letters.</li>
|
||||
</ul>
|
@@ -0,0 +1,71 @@
|
||||
<p>You are given a <strong>0-indexed</strong> string <code>s</code> and an integer <code>k</code>.</p>
|
||||
|
||||
<p>You are to perform the following partitioning operations until <code>s</code> is <strong>empty</strong>:</p>
|
||||
|
||||
<ul>
|
||||
<li>Choose the <strong>longest</strong> <strong>prefix</strong> of <code>s</code> containing at most <code>k</code> <strong>distinct</strong> characters.</li>
|
||||
<li><strong>Delete</strong> the prefix from <code>s</code> and increase the number of partitions by one. The remaining characters (if any) in <code>s</code> maintain their initial order.</li>
|
||||
</ul>
|
||||
|
||||
<p><strong>Before</strong> the operations, you are allowed to change <strong>at most</strong> <strong>one</strong> index in <code>s</code> to another lowercase English letter.</p>
|
||||
|
||||
<p>Return <em>an integer denoting the <strong>maximum</strong> number of resulting partitions after the operations by optimally choosing at most one index to change.</em></p>
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "accca", k = 2
|
||||
<strong>Output:</strong> 3
|
||||
<strong>Explanation: </strong>In this example, to maximize the number of resulting partitions, s[2] can be changed to 'b'.
|
||||
s becomes "acbca".
|
||||
The operations can now be performed as follows until s becomes empty:
|
||||
- Choose the longest prefix containing at most 2 distinct characters, "<u>ac</u>bca".
|
||||
- Delete the prefix, and s becomes "bca". The number of partitions is now 1.
|
||||
- Choose the longest prefix containing at most 2 distinct characters, "<u>bc</u>a".
|
||||
- Delete the prefix, and s becomes "a". The number of partitions is now 2.
|
||||
- Choose the longest prefix containing at most 2 distinct characters, "<u>a</u>".
|
||||
- Delete the prefix, and s becomes empty. The number of partitions is now 3.
|
||||
Hence, the answer is 3.
|
||||
It can be shown that it is not possible to obtain more than 3 partitions.</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "aabaab", k = 3
|
||||
<strong>Output:</strong> 1
|
||||
<strong>Explanation: </strong>In this example, to maximize the number of resulting partitions we can leave s as it is.
|
||||
The operations can now be performed as follows until s becomes empty:
|
||||
- Choose the longest prefix containing at most 3 distinct characters, "<u>aabaab</u>".
|
||||
- Delete the prefix, and s becomes empty. The number of partitions becomes 1.
|
||||
Hence, the answer is 1.
|
||||
It can be shown that it is not possible to obtain more than 1 partition.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "xxyz", k = 1
|
||||
<strong>Output:</strong> 4
|
||||
<strong>Explanation:</strong> In this example, to maximize the number of resulting partitions, s[1] can be changed to 'a'.
|
||||
s becomes "xayz".
|
||||
The operations can now be performed as follows until s becomes empty:
|
||||
- Choose the longest prefix containing at most 1 distinct character, "<u>x</u>ayz".
|
||||
- Delete the prefix, and s becomes "ayz". The number of partitions is now 1.
|
||||
- Choose the longest prefix containing at most 1 distinct character, "<u>a</u>yz".
|
||||
- Delete the prefix, and s becomes "yz". The number of partitions is now 2.
|
||||
- Choose the longest prefix containing at most 1 distinct character, "<u>y</u>z".
|
||||
- Delete the prefix, and s becomes "z". The number of partitions is now 3.
|
||||
- Choose the longest prefix containing at most 1 distinct character, "<u>z</u>".
|
||||
- Delete the prefix, and s becomes empty. The number of partitions is now 4.
|
||||
Hence, the answer is 4.
|
||||
It can be shown that it is not possible to obtain more than 4 partitions.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 10<sup>4</sup></code></li>
|
||||
<li><code>s</code> consists only of lowercase English letters.</li>
|
||||
<li><code>1 <= k <= 26</code></li>
|
||||
</ul>
|
@@ -0,0 +1,34 @@
|
||||
<p>You are given a 2D <strong>0-indexed </strong>integer array <code>dimensions</code>.</p>
|
||||
|
||||
<p>For all indices <code>i</code>, <code>0 <= i < dimensions.length</code>, <code>dimensions[i][0]</code> represents the length and <code>dimensions[i][1]</code> represents the width of the rectangle<span style="font-size: 13.3333px;"> <code>i</code></span>.</p>
|
||||
|
||||
<p>Return <em>the <strong>area</strong> of the rectangle having the <strong>longest</strong> diagonal. If there are multiple rectangles with the longest diagonal, return the area of the rectangle having the <strong>maximum</strong> area.</em></p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> dimensions = [[9,3],[8,6]]
|
||||
<strong>Output:</strong> 48
|
||||
<strong>Explanation:</strong>
|
||||
For index = 0, length = 9 and width = 3. Diagonal length = sqrt(9 * 9 + 3 * 3) = sqrt(90) ≈<!-- notionvc: 882cf44c-3b17-428e-9c65-9940810216f1 --> 9.487.
|
||||
For index = 1, length = 8 and width = 6. Diagonal length = sqrt(8 * 8 + 6 * 6) = sqrt(100) = 10.
|
||||
So, the rectangle at index 1 has a greater diagonal length therefore we return area = 8 * 6 = 48.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> dimensions = [[3,4],[4,3]]
|
||||
<strong>Output:</strong> 12
|
||||
<strong>Explanation:</strong> Length of diagonal is the same for both which is 5, so maximum area = 12.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= dimensions.length <= 100</code></li>
|
||||
<li><code><font face="monospace">dimensions[i].length == 2</font></code></li>
|
||||
<li><code><font face="monospace">1 <= dimensions[i][0], dimensions[i][1] <= 100</font></code></li>
|
||||
</ul>
|
43
leetcode/problem/maximum-size-of-a-set-after-removals.html
Normal file
43
leetcode/problem/maximum-size-of-a-set-after-removals.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code> of even length <code>n</code>.</p>
|
||||
|
||||
<p>You must remove <code>n / 2</code> elements from <code>nums1</code> and <code>n / 2</code> elements from <code>nums2</code>. After the removals, you insert the remaining elements of <code>nums1</code> and <code>nums2</code> into a set <code>s</code>.</p>
|
||||
|
||||
<p>Return <em>the <strong>maximum</strong> possible size of the set</em> <code>s</code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums1 = [1,2,1,2], nums2 = [1,1,1,1]
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> We remove two occurences of 1 from nums1 and nums2. After the removals, the arrays become equal to nums1 = [2,2] and nums2 = [1,1]. Therefore, s = {1,2}.
|
||||
It can be shown that 2 is the maximum possible size of the set s after the removals.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums1 = [1,2,3,4,5,6], nums2 = [2,3,2,3,2,3]
|
||||
<strong>Output:</strong> 5
|
||||
<strong>Explanation:</strong> We remove 2, 3, and 6 from nums1, as well as 2 and two occurrences of 3 from nums2. After the removals, the arrays become equal to nums1 = [1,4,5] and nums2 = [2,3,2]. Therefore, s = {1,2,3,4,5}.
|
||||
It can be shown that 5 is the maximum possible size of the set s after the removals.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums1 = [1,1,2,2,3,3], nums2 = [4,4,5,5,6,6]
|
||||
<strong>Output:</strong> 6
|
||||
<strong>Explanation:</strong> We remove 1, 2, and 3 from nums1, as well as 4, 5, and 6 from nums2. After the removals, the arrays become equal to nums1 = [1,2,3] and nums2 = [4,5,6]. Therefore, s = {1,2,3,4,5,6}.
|
||||
It can be shown that 6 is the maximum possible size of the set s after the removals.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>n == nums1.length == nums2.length</code></li>
|
||||
<li><code>1 <= n <= 2 * 10<sup>4</sup></code></li>
|
||||
<li><code>n</code> is even.</li>
|
||||
<li><code>1 <= nums1[i], nums2[i] <= 10<sup>9</sup></code></li>
|
||||
</ul>
|
48
leetcode/problem/minimum-moves-to-capture-the-queen.html
Normal file
48
leetcode/problem/minimum-moves-to-capture-the-queen.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<p>There is a <strong>1-indexed</strong> <code>8 x 8</code> chessboard containing <code>3</code> pieces.</p>
|
||||
|
||||
<p>You are given <code>6</code> integers <code>a</code>, <code>b</code>, <code>c</code>, <code>d</code>, <code>e</code>, and <code>f</code> where:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>(a, b)</code> denotes the position of the white rook.</li>
|
||||
<li><code>(c, d)</code> denotes the position of the white bishop.</li>
|
||||
<li><code>(e, f)</code> denotes the position of the black queen.</li>
|
||||
</ul>
|
||||
|
||||
<p>Given that you can only move the white pieces, return <em>the <strong>minimum</strong> number of moves required to capture the black queen</em>.</p>
|
||||
|
||||
<p><strong>Note</strong> that:</p>
|
||||
|
||||
<ul>
|
||||
<li>Rooks can move any number of squares either vertically or horizontally, but cannot jump over other pieces.</li>
|
||||
<li>Bishops can move any number of squares diagonally, but cannot jump over other pieces.</li>
|
||||
<li>A rook or a bishop can capture the queen if it is located in a square that they can move to.</li>
|
||||
<li>The queen does not move.</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2023/12/21/ex1.png" style="width: 600px; height: 600px; padding: 10px; background: #fff; border-radius: .5rem;" />
|
||||
<pre>
|
||||
<strong>Input:</strong> a = 1, b = 1, c = 8, d = 8, e = 2, f = 3
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> We can capture the black queen in two moves by moving the white rook to (1, 3) then to (2, 3).
|
||||
It is impossible to capture the black queen in less than two moves since it is not being attacked by any of the pieces at the beginning.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
<img alt="" src="https://assets.leetcode.com/uploads/2023/12/21/ex2.png" style="width: 600px; height: 600px;padding: 10px; background: #fff; border-radius: .5rem;" />
|
||||
<pre>
|
||||
<strong>Input:</strong> a = 5, b = 3, c = 3, d = 4, e = 5, f = 2
|
||||
<strong>Output:</strong> 1
|
||||
<strong>Explanation:</strong> We can capture the black queen in a single move by doing one of the following:
|
||||
- Move the white rook to (5, 2).
|
||||
- Move the white bishop to (5, 2).
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= a, b, c, d, e, f <= 8</code></li>
|
||||
<li>No two pieces are on the same square.</li>
|
||||
</ul>
|
@@ -0,0 +1,41 @@
|
||||
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and a positive integer <code>k</code>.</p>
|
||||
|
||||
<p>You can apply the following operation on the array <strong>any</strong> number of times:</p>
|
||||
|
||||
<ul>
|
||||
<li>Choose <strong>any</strong> element of the array and <strong>flip</strong> a bit in its <strong>binary</strong> representation. Flipping a bit means changing a <code>0</code> to <code>1</code> or vice versa.</li>
|
||||
</ul>
|
||||
|
||||
<p>Return <em>the <strong>minimum</strong> number of operations required to make the bitwise </em><code>XOR</code><em> of <strong>all</strong> elements of the final array equal to </em><code>k</code>.</p>
|
||||
|
||||
<p><strong>Note</strong> that you can flip leading zero bits in the binary representation of elements. For example, for the number <code>(101)<sub>2</sub></code> you can flip the fourth bit and obtain <code>(1101)<sub>2</sub></code>.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [2,1,3,4], k = 1
|
||||
<strong>Output:</strong> 2
|
||||
<strong>Explanation:</strong> We can do the following operations:
|
||||
- Choose element 2 which is 3 == (011)<sub>2</sub>, we flip the first bit and we obtain (010)<sub>2</sub> == 2. nums becomes [2,1,2,4].
|
||||
- Choose element 0 which is 2 == (010)<sub>2</sub>, we flip the third bit and we obtain (110)<sub>2</sub> = 6. nums becomes [6,1,2,4].
|
||||
The XOR of elements of the final array is (6 XOR 1 XOR 2 XOR 4) == 1 == k.
|
||||
It can be shown that we cannot make the XOR equal to k in less than 2 operations.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [2,0,2,0], k = 0
|
||||
<strong>Output:</strong> 0
|
||||
<strong>Explanation:</strong> The XOR of elements of the array is (2 XOR 0 XOR 2 XOR 0) == 0 == k. So no operation is needed.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>0 <= nums[i] <= 10<sup>6</sup></code></li>
|
||||
<li><code>0 <= k <= 10<sup>6</sup></code></li>
|
||||
</ul>
|
@@ -0,0 +1,59 @@
|
||||
<p>You are given two positive integers <code>x</code> and <code>y</code>.</p>
|
||||
|
||||
<p>In one operation, you can do one of the four following operations:</p>
|
||||
|
||||
<ol>
|
||||
<li>Divide <code>x</code> by <code>11</code> if <code>x</code> is a multiple of <code>11</code>.</li>
|
||||
<li>Divide <code>x</code> by <code>5</code> if <code>x</code> is a multiple of <code>5</code>.</li>
|
||||
<li>Decrement <code>x</code> by <code>1</code>.</li>
|
||||
<li>Increment <code>x</code> by <code>1</code>.</li>
|
||||
</ol>
|
||||
|
||||
<p>Return <em>the <strong>minimum</strong> number of operations required to make </em> <code>x</code> <i>and</i> <code>y</code> equal.</p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> x = 26, y = 1
|
||||
<strong>Output:</strong> 3
|
||||
<strong>Explanation:</strong> We can make 26 equal to 1 by applying the following operations:
|
||||
1. Decrement x by 1
|
||||
2. Divide x by 5
|
||||
3. Divide x by 5
|
||||
It can be shown that 3 is the minimum number of operations required to make 26 equal to 1.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> x = 54, y = 2
|
||||
<strong>Output:</strong> 4
|
||||
<strong>Explanation:</strong> We can make 54 equal to 2 by applying the following operations:
|
||||
1. Increment x by 1
|
||||
2. Divide x by 11
|
||||
3. Divide x by 5
|
||||
4. Increment x by 1
|
||||
It can be shown that 4 is the minimum number of operations required to make 54 equal to 2.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> x = 25, y = 30
|
||||
<strong>Output:</strong> 5
|
||||
<strong>Explanation:</strong> We can make 25 equal to 30 by applying the following operations:
|
||||
1. Increment x by 1
|
||||
2. Increment x by 1
|
||||
3. Increment x by 1
|
||||
4. Increment x by 1
|
||||
5. Increment x by 1
|
||||
It can be shown that 5 is the minimum number of operations required to make 25 equal to 30.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= x, y <= 10<sup>4</sup></code></li>
|
||||
</ul>
|
78
leetcode/problem/palindrome-rearrangement-queries.html
Normal file
78
leetcode/problem/palindrome-rearrangement-queries.html
Normal file
@@ -0,0 +1,78 @@
|
||||
<p>You are given a <strong>0-indexed</strong> string <code>s</code> having an <strong>even</strong> length <code>n</code>.</p>
|
||||
|
||||
<p>You are also given a <strong>0-indexed</strong> 2D integer array, <code>queries</code>, where <code>queries[i] = [a<sub>i</sub>, b<sub>i</sub>, c<sub>i</sub>, d<sub>i</sub>]</code>.</p>
|
||||
|
||||
<p>For each query <code>i</code>, you are allowed to perform the following operations:</p>
|
||||
|
||||
<ul>
|
||||
<li>Rearrange the characters within the <strong>substring</strong> <code>s[a<sub>i</sub>:b<sub>i</sub>]</code>, where <code>0 <= a<sub>i</sub> <= b<sub>i</sub> < n / 2</code>.</li>
|
||||
<li>Rearrange the characters within the <strong>substring</strong> <code>s[c<sub>i</sub>:d<sub>i</sub>]</code>, where <code>n / 2 <= c<sub>i</sub> <= d<sub>i</sub> < n</code>.</li>
|
||||
</ul>
|
||||
|
||||
<p>For each query, your task is to determine whether it is possible to make <code>s</code> a <strong>palindrome</strong> by performing the operations.</p>
|
||||
|
||||
<p>Each query is answered <strong>independently</strong> of the others.</p>
|
||||
|
||||
<p>Return <em>a <strong>0-indexed</strong> array </em><code>answer</code><em>, where </em><code>answer[i] == true</code><em> if it is possible to make </em><code>s</code><em> a palindrome by performing operations specified by the </em><code>i<sup>th</sup></code><em> query, and </em><code>false</code><em> otherwise.</em></p>
|
||||
|
||||
<ul>
|
||||
<li>A <strong>substring</strong> is a contiguous sequence of characters within a string.</li>
|
||||
<li><code>s[x:y]</code> represents the substring consisting of characters from the index <code>x</code> to index <code>y</code> in <code>s</code>, <strong>both inclusive</strong>.</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abcabc", queries = [[1,1,3,5],[0,2,5,5]]
|
||||
<strong>Output:</strong> [true,true]
|
||||
<strong>Explanation:</strong> In this example, there are two queries:
|
||||
In the first query:
|
||||
- a<sub>0</sub> = 1, b<sub>0</sub> = 1, c<sub>0</sub> = 3, d<sub>0</sub> = 5.
|
||||
- So, you are allowed to rearrange s[1:1] => a<u>b</u>cabc and s[3:5] => abc<u>abc</u>.
|
||||
- To make s a palindrome, s[3:5] can be rearranged to become => abc<u>cba</u>.
|
||||
- Now, s is a palindrome. So, answer[0] = true.
|
||||
In the second query:
|
||||
- a<sub>1</sub> = 0, b<sub>1</sub> = 2, c<sub>1</sub> = 5, d<sub>1</sub> = 5.
|
||||
- So, you are allowed to rearrange s[0:2] => <u>abc</u>abc and s[5:5] => abcab<u>c</u>.
|
||||
- To make s a palindrome, s[0:2] can be rearranged to become => <u>cba</u>abc.
|
||||
- Now, s is a palindrome. So, answer[1] = true.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "abbcdecbba", queries = [[0,2,7,9]]
|
||||
<strong>Output:</strong> [false]
|
||||
<strong>Explanation:</strong> In this example, there is only one query.
|
||||
a<sub>0</sub> = 0, b<sub>0</sub> = 2, c<sub>0</sub> = 7, d<sub>0</sub> = 9.
|
||||
So, you are allowed to rearrange s[0:2] => <u>abb</u>cdecbba and s[7:9] => abbcdec<u>bba</u>.
|
||||
It is not possible to make s a palindrome by rearranging these substrings because s[3:6] is not a palindrome.
|
||||
So, answer[0] = false.</pre>
|
||||
|
||||
<p><strong class="example">Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> s = "acbcab", queries = [[1,2,4,5]]
|
||||
<strong>Output:</strong> [true]
|
||||
<strong>Explanation: </strong>In this example, there is only one query.
|
||||
a<sub>0</sub> = 1, b<sub>0</sub> = 2, c<sub>0</sub> = 4, d<sub>0</sub> = 5.
|
||||
So, you are allowed to rearrange s[1:2] => a<u>cb</u>cab and s[4:5] => acbc<u>ab</u>.
|
||||
To make s a palindrome s[1:2] can be rearranged to become a<u>bc</u>cab.
|
||||
Then, s[4:5] can be rearranged to become abcc<u>ba</u>.
|
||||
Now, s is a palindrome. So, answer[0] = true.</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>2 <= n == s.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>1 <= queries.length <= 10<sup>5</sup></code></li>
|
||||
<li><code>queries[i].length == 4</code></li>
|
||||
<li><code>a<sub>i</sub> == queries[i][0], b<sub>i</sub> == queries[i][1]</code></li>
|
||||
<li><code>c<sub>i</sub> == queries[i][2], d<sub>i</sub> == queries[i][3]</code></li>
|
||||
<li><code>0 <= a<sub>i</sub> <= b<sub>i</sub> < n / 2</code></li>
|
||||
<li><code>n / 2 <= c<sub>i</sub> <= d<sub>i</sub> < n </code></li>
|
||||
<li><code>n</code> is even.</li>
|
||||
<li><code>s</code> consists of only lowercase English letters.</li>
|
||||
</ul>
|
@@ -0,0 +1,30 @@
|
||||
<p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code>.</p>
|
||||
|
||||
<p>A prefix <code>nums[0..i]</code> is <strong>sequential</strong> if, for all <code>1 <= j <= i</code>, <code>nums[j] = nums[j - 1] + 1</code>. In particular, the prefix consisting only of <code>nums[0]</code> is <strong>sequential</strong>.</p>
|
||||
|
||||
<p>Return <em>the <strong>smallest</strong> integer</em> <code>x</code> <em>missing from</em> <code>nums</code> <em>such that</em> <code>x</code> <em>is greater than or equal to the sum of the <strong>longest</strong> sequential prefix.</em></p>
|
||||
|
||||
<p> </p>
|
||||
<p><strong class="example">Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [1,2,3,2,5]
|
||||
<strong>Output:</strong> 6
|
||||
<strong>Explanation:</strong> The longest sequential prefix of nums is [1,2,3] with a sum of 6. 6 is not in the array, therefore 6 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix.
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [3,4,5,1,12,14,13]
|
||||
<strong>Output:</strong> 15
|
||||
<strong>Explanation:</strong> The longest sequential prefix of nums is [3,4,5] with a sum of 12. 12, 13, and 14 belong to the array while 15 does not. Therefore 15 is the smallest missing integer greater than or equal to the sum of the longest sequential prefix.
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 50</code></li>
|
||||
<li><code>1 <= nums[i] <= 50</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user