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
f14c8312c2
commit
f05348ae2b
@ -1,6 +1,6 @@
|
||||
# 力扣题库(完整版)
|
||||
|
||||
> 最后更新日期: **2023.12.29**
|
||||
> 最后更新日期: **2024.01.09**
|
||||
>
|
||||
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,60 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3282",
|
||||
"questionFrontendId": "2985",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586418,
|
||||
"title": "Calculate Compressed Mean",
|
||||
"titleSlug": "calculate-compressed-mean",
|
||||
"content": null,
|
||||
"translatedTitle": "计算订单平均商品数量",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"49\", \"totalSubmission\": \"56\", \"totalAcceptedRaw\": 49, \"totalSubmissionRaw\": 56, \"acRate\": \"87.5%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"exampleTestcases": "{\"headers\":{\"Orders\":[\"order_id\",\"item_count\",\"order_occurrences\"]},\"rows\":{\"Orders\":[[10,1,500],[11,2,1000],[12,3,800],[13,4,1000]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
62
leetcode-cn/originData/[no content]class-performance.json
Normal file
62
leetcode-cn/originData/[no content]class-performance.json
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3286",
|
||||
"questionFrontendId": "2989",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586388,
|
||||
"title": "Class Performance",
|
||||
"titleSlug": "class-performance",
|
||||
"content": null,
|
||||
"translatedTitle": "班级表现",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"60\", \"totalSubmission\": \"60\", \"totalAcceptedRaw\": 60, \"totalSubmissionRaw\": 60, \"acRate\": \"100.0%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3284",
|
||||
"questionFrontendId": "2987",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586420,
|
||||
"title": "Find Expensive Cities",
|
||||
"titleSlug": "find-expensive-cities",
|
||||
"content": null,
|
||||
"translatedTitle": "寻找房价最贵的城市",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"43\", \"totalSubmission\": \"46\", \"totalAcceptedRaw\": 43, \"totalSubmissionRaw\": 46, \"acRate\": \"93.5%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3281",
|
||||
"questionFrontendId": "2984",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586419,
|
||||
"title": "Find Peak Calling Hours for Each City",
|
||||
"titleSlug": "find-peak-calling-hours-for-each-city",
|
||||
"content": null,
|
||||
"translatedTitle": "找到每座城市的高峰通话时间",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"37\", \"totalSubmission\": \"54\", \"totalAcceptedRaw\": 37, \"totalSubmissionRaw\": 54, \"acRate\": \"68.5%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3283",
|
||||
"questionFrontendId": "2986",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586391,
|
||||
"title": "Find Third Transaction",
|
||||
"titleSlug": "find-third-transaction",
|
||||
"content": null,
|
||||
"translatedTitle": "找到第三笔交易",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"32\", \"totalSubmission\": \"47\", \"totalAcceptedRaw\": 32, \"totalSubmissionRaw\": 47, \"acRate\": \"68.1%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
64
leetcode-cn/originData/[no content]friday-purchases-i.json
Normal file
64
leetcode-cn/originData/[no content]friday-purchases-i.json
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3300",
|
||||
"questionFrontendId": "2993",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2591528,
|
||||
"title": "Friday Purchases I",
|
||||
"titleSlug": "friday-purchases-i",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"24\", \"totalSubmission\": \"26\", \"totalAcceptedRaw\": 24, \"totalSubmissionRaw\": 26, \"acRate\": \"92.3%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
64
leetcode-cn/originData/[no content]friday-purchases-ii.json
Normal file
64
leetcode-cn/originData/[no content]friday-purchases-ii.json
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3301",
|
||||
"questionFrontendId": "2994",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2591527,
|
||||
"title": "Friday Purchases II ",
|
||||
"titleSlug": "friday-purchases-ii",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"17\", \"totalSubmission\": \"17\", \"totalAcceptedRaw\": 17, \"totalSubmissionRaw\": 17, \"acRate\": \"100.0%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
64
leetcode-cn/originData/[no content]loan-types.json
Normal file
64
leetcode-cn/originData/[no content]loan-types.json
Normal file
@ -0,0 +1,64 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3287",
|
||||
"questionFrontendId": "2990",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586390,
|
||||
"title": "Loan Types",
|
||||
"titleSlug": "loan-types",
|
||||
"content": null,
|
||||
"translatedTitle": "贷款类型",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"50\", \"totalSubmission\": \"82\", \"totalAcceptedRaw\": 50, \"totalSubmissionRaw\": 82, \"acRate\": \"61.0%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3285",
|
||||
"questionFrontendId": "2988",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586421,
|
||||
"title": "Manager of the Largest Department",
|
||||
"titleSlug": "manager-of-the-largest-department",
|
||||
"content": null,
|
||||
"translatedTitle": "最大部门的经理",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"40\", \"totalSubmission\": \"47\", \"totalAcceptedRaw\": 40, \"totalSubmissionRaw\": 47, \"acRate\": \"85.1%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
65
leetcode-cn/originData/[no content]top-three-wineries.json
Normal file
65
leetcode-cn/originData/[no content]top-three-wineries.json
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3288",
|
||||
"questionFrontendId": "2991",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2586387,
|
||||
"title": "Top Three Wineries ",
|
||||
"titleSlug": "top-three-wineries",
|
||||
"content": null,
|
||||
"translatedTitle": "最好的三家酒庄",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"25\", \"totalSubmission\": \"43\", \"totalAcceptedRaw\": 25, \"totalSubmissionRaw\": 43, \"acRate\": \"58.1%\"}",
|
||||
"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,
|
||||
"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>\"]}",
|
||||
"book": null,
|
||||
"isSubscribed": false,
|
||||
"isDailyQuestion": false,
|
||||
"dailyRecordStatus": null,
|
||||
"editorType": "CKEDITOR",
|
||||
"ugcQuestionId": null,
|
||||
"style": "LEETCODE",
|
||||
"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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "3302",
|
||||
"questionFrontendId": "2995",
|
||||
"categoryTitle": "Database",
|
||||
"boundTopicId": 2591529,
|
||||
"title": "Viewers Turned Streamers",
|
||||
"titleSlug": "viewers-turned-streamers",
|
||||
"content": null,
|
||||
"translatedTitle": "观众变主播",
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 0,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"contributors": [],
|
||||
"langToValidPlayground": null,
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": "数据库",
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"24\", \"totalSubmission\": \"45\", \"totalAcceptedRaw\": 24, \"totalSubmissionRaw\": 45, \"acRate\": \"53.3%\"}",
|
||||
"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,
|
||||
"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-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\"]]}}",
|
||||
"__typename": "QuestionNode"
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
184
leetcode-cn/originData/maximum-size-of-a-set-after-removals.json
Normal file
184
leetcode-cn/originData/maximum-size-of-a-set-after-removals.json
Normal file
File diff suppressed because one or more lines are too long
177
leetcode-cn/originData/minimum-moves-to-capture-the-queen.json
Normal file
177
leetcode-cn/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
188
leetcode-cn/originData/palindrome-rearrangement-queries.json
Normal file
188
leetcode-cn/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
@ -0,0 +1,61 @@
|
||||
<p>给你两个正整数 <code>x</code> 和 <code>y</code> 。</p>
|
||||
|
||||
<p>一次操作中,你可以执行以下四种操作之一:</p>
|
||||
|
||||
<ol>
|
||||
<li>如果 <code>x</code> 是 <code>11</code> 的倍数,将 <code>x</code> 除以 <code>11</code> 。</li>
|
||||
<li>如果 <code>x</code> 是 <code>5</code> 的倍数,将 <code>x</code> 除以 <code>5</code> 。</li>
|
||||
<li>将 <code>x</code> 减 <code>1</code> 。</li>
|
||||
<li>将 <code>x</code> 加 <code>1</code> 。</li>
|
||||
</ol>
|
||||
|
||||
<p>请你返回让 <code>x</code> 和 <code>y</code> 相等的 <strong>最少</strong> 操作次数。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>x = 26, y = 1
|
||||
<b>输出:</b>3
|
||||
<b>解释</b><strong>:</strong>我们可以通过以下操作将 26 变为 1 :
|
||||
1. 将 x 减 1
|
||||
2. 将 x 除以 5
|
||||
3. 将 x 除以 5
|
||||
将 26 变为 1 最少需要 3 次操作。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>x = 54, y = 2
|
||||
<b>输出:</b>4
|
||||
<b>解释:</b>我们可以通过以下操作将 54 变为 2 :
|
||||
1. 将 x 加 1
|
||||
2. 将 x 除以 11
|
||||
3. 将 x 除以 5
|
||||
4. 将 x 加 1
|
||||
将 54 变为 2 最少需要 4 次操作。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>x = 25, y = 30
|
||||
<b>输出:</b>5
|
||||
<b>解释:</b>我们可以通过以下操作将 25 变为 30 :
|
||||
1. 将 x 加 1
|
||||
2. 将 x 加 1
|
||||
3. 将 x 加 1
|
||||
4. 将 x 加 1
|
||||
5. 将 x 加 1
|
||||
将 25 变为 30 最少需要 5 次操作。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= x, y <= 10<sup>4</sup></code></li>
|
||||
</ul>
|
@ -0,0 +1,43 @@
|
||||
<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> 和一个正整数 <code>k</code> 。</p>
|
||||
|
||||
<p>你可以对数组执行以下操作 <strong>任意次</strong> :</p>
|
||||
|
||||
<ul>
|
||||
<li>选择数组里的 <strong>任意</strong> 一个元素,并将它的 <strong>二进制</strong> 表示 <strong>翻转</strong> 一个数位,翻转数位表示将 <code>0</code> 变成 <code>1</code> 或者将 <code>1</code> 变成 <code>0</code> 。</li>
|
||||
</ul>
|
||||
|
||||
<p>你的目标是让数组里 <strong>所有</strong> 元素的按位异或和得到 <code>k</code> ,请你返回达成这一目标的 <strong>最少 </strong>操作次数。</p>
|
||||
|
||||
<p><strong>注意</strong>,你也可以将一个数的前导 0 翻转。比方说,数字 <code>(101)<sub>2</sub></code> 翻转第四个数位,得到 <code>(1101)<sub>2</sub></code> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [2,1,3,4], k = 1
|
||||
<b>输出:</b>2
|
||||
<b>解释:</b>我们可以执行以下操作:
|
||||
- 选择下标为 2 的元素,也就是 3 == (011)<sub>2</sub> ,我们翻转第一个数位得到 (010)<sub>2</sub> == 2 。数组变为 [2,1,2,4] 。
|
||||
- 选择下标为 0 的元素,也就是 2 == (010)<sub>2</sub> ,我们翻转第三个数位得到 (110)<sub>2</sub> == 6 。数组变为 [6,1,2,4] 。
|
||||
最终数组的所有元素异或和为 (6 XOR 1 XOR 2 XOR 4) == 1 == k 。
|
||||
无法用少于 2 次操作得到异或和等于 k 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [2,0,2,0], k = 0
|
||||
<b>输出:</b>0
|
||||
<strong>解释:</strong>数组所有元素的异或和为 (2 XOR 0 XOR 2 XOR 0) == 0 == k 。所以不需要进行任何操作。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</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,80 @@
|
||||
<p>给你一个长度为 <strong>偶数</strong> <code>n</code> ,下标从 <strong>0</strong> 开始的字符串 <code>s</code> 。</p>
|
||||
|
||||
<p>同时给你一个下标从 <strong>0</strong> 开始的二维整数数组 <code>queries</code> ,其中 <code>queries[i] = [a<sub>i</sub>, b<sub>i</sub>, c<sub>i</sub>, d<sub>i</sub>]</code> 。</p>
|
||||
|
||||
<p>对于每个查询 <code>i</code> ,你需要执行以下操作:</p>
|
||||
|
||||
<ul>
|
||||
<li>将下标在范围 <code>0 <= a<sub>i</sub> <= b<sub>i</sub> < n / 2</code> 内的 <strong>子字符串</strong> <code>s[a<sub>i</sub>:b<sub>i</sub>]</code> 中的字符重新排列。</li>
|
||||
<li>将下标在范围 <code>n / 2 <= c<sub>i</sub> <= d<sub>i</sub> < n</code> 内的 <strong>子字符串</strong> <code>s[c<sub>i</sub>:d<sub>i</sub>]</code> 中的字符重新排列。</li>
|
||||
</ul>
|
||||
|
||||
<p>对于每个查询,你的任务是判断执行操作后能否让 <code>s</code> 变成一个 <strong>回文串</strong> 。</p>
|
||||
|
||||
<p>每个查询与其他查询都是 <strong>独立的</strong> 。</p>
|
||||
|
||||
<p>请你返回一个下标从 <strong>0</strong> 开始的数组<em> </em><code>answer</code> ,如果第 <code>i</code> 个查询执行操作后,可以将 <code>s</code> 变为一个回文串,那么<em> </em><code>answer[i] = true</code>,否则为<em> </em><code>false</code> 。</p>
|
||||
|
||||
<ul>
|
||||
<li><strong>子字符串</strong> 指的是一个字符串中一段连续的字符序列。</li>
|
||||
<li><code>s[x:y]</code> 表示 <code>s</code> 中从下标 <code>x</code> 到 <code>y</code> 且两个端点 <strong>都包含</strong> 的子字符串。</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>s = "abcabc", queries = [[1,1,3,5],[0,2,5,5]]
|
||||
<b>输出:</b>[true,true]
|
||||
<b>解释:</b>这个例子中,有 2 个查询:
|
||||
第一个查询:
|
||||
- a<sub>0</sub> = 1, b<sub>0</sub> = 1, c<sub>0</sub> = 3, d<sub>0</sub> = 5
|
||||
- 你可以重新排列 s[1:1] => a<em><strong>b</strong></em>cabc 和 s[3:5] => abc<em><strong>abc</strong></em> 。
|
||||
- 为了让 s 变为回文串,s[3:5] 可以重新排列得到 => abc<strong><em>cba </em></strong>。
|
||||
- 现在 s 是一个回文串。所以 answer[0] = true 。
|
||||
第二个查询:
|
||||
- a<sub>1</sub> = 0, b<sub>1</sub> = 2, c<sub>1</sub> = 5, d<sub>1</sub> = 5.
|
||||
- 你可以重新排列 s[0:2] => <em><strong>abc</strong></em>abc 和 s[5:5] => abcab<strong><em>c</em></strong> 。
|
||||
- 为了让 s 变为回文串,s[0:2] 可以重新排列得到 => <em><strong>cba</strong></em>abc 。
|
||||
- 现在 s 是一个回文串,所以 answer[1] = true 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>s = "abbcdecbba", queries = [[0,2,7,9]]
|
||||
<b>输出:</b>[false]
|
||||
<b>解释:</b>这个示例中,只有一个查询。
|
||||
a<sub>0</sub> = 0, b<sub>0</sub> = 2, c<sub>0</sub> = 7, d<sub>0</sub> = 9.
|
||||
你可以重新排列 s[0:2] => <em><strong>abb</strong></em>cdecbba 和 s[7:9] => abbcdec<em><strong>bba</strong></em> 。
|
||||
无法通过重新排列这些子字符串使 s 变为一个回文串,因为 s[3:6] 不是一个回文串。
|
||||
所以 answer[0] = false 。</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>s = "acbcab", queries = [[1,2,4,5]]
|
||||
<b>输出:</b>[true]
|
||||
<strong>解释:</strong>这个示例中,只有一个查询。
|
||||
a<sub>0</sub> = 1, b<sub>0</sub> = 2, c<sub>0</sub> = 4, d<sub>0</sub> = 5.
|
||||
你可以重新排列 s[1:2] => a<em><strong>cb</strong></em>cab 和 s[4:5] => acbc<strong><em>ab</em></strong> 。
|
||||
为了让 s 变为回文串,s[1:2] 可以重新排列得到 => a<em><strong>bc</strong></em>cab<code> </code>。
|
||||
然后 s[4:5] 重新排列得到 abcc<em><strong>ba</strong></em> 。
|
||||
现在 s 是一个回文串,所以 answer[0] = true 。</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</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> 是一个偶数。</li>
|
||||
<li><code>s</code> 只包含小写英文字母。</li>
|
||||
</ul>
|
@ -0,0 +1,32 @@
|
||||
<p>给你一个下标从 <strong>0</strong> 开始的整数数组 <code>nums</code> 。</p>
|
||||
|
||||
<p>如果一个前缀 <code>nums[0..i]</code> 满足对于 <code>1 <= j <= i</code> 的所有元素都有 <code>nums[j] = nums[j - 1] + 1</code> ,那么我们称这个前缀是一个 <strong>顺序前缀</strong> 。特殊情况是,只包含 <code>nums[0]</code> 的前缀也是一个 <strong>顺序前缀</strong> 。</p>
|
||||
|
||||
<p>请你返回 <code>nums</code> 中没有出现过的 <strong>最小</strong> 整数 <code>x</code> ,满足 <code>x</code> 大于等于 <strong>最长</strong> 顺序前缀的和。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>nums = [1,2,3,2,5]
|
||||
<b>输出:</b>6
|
||||
<b>解释:</b>nums 的最长顺序前缀是 [1,2,3] ,和为 6 ,6 不在数组中,所以 6 是大于等于最长顺序前缀和的最小整数。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [3,4,5,1,12,14,13]
|
||||
<b>输出:</b>15
|
||||
<b>解释:</b>nums 的最长顺序前缀是 [3,4,5] ,和为 12 ,12、13 和 14 都在数组中,但 15 不在,所以 15 是大于等于最长顺序前缀和的最小整数。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 50</code></li>
|
||||
<li><code>1 <= nums[i] <= 50</code></li>
|
||||
</ul>
|
@ -0,0 +1,36 @@
|
||||
<p>给你一个下标从<strong> 0</strong> 开始的二维整数数组 <code>dimensions</code>。</p>
|
||||
|
||||
<p>对于所有下标 <code>i</code>(<code>0 <= i < dimensions.length</code>),<code>dimensions[i][0]</code> 表示矩形 <span style="font-size: 13.3333px;"> <code>i</code></span> 的长度,而 <code>dimensions[i][1]</code> 表示矩形 <span style="font-size: 13.3333px;"> <code>i</code></span> 的宽度。</p>
|
||||
|
||||
<p>返回对角线最 <strong>长 </strong>的矩形的<strong> 面积 </strong>。如果存在多个对角线长度相同的矩形,返回面积最<strong> 大 </strong>的矩形的面积。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>dimensions = [[9,3],[8,6]]
|
||||
<strong>输出:</strong>48
|
||||
<strong>解释:</strong>
|
||||
下标 = 0,长度 = 9,宽度 = 3。对角线长度 = sqrt(9 * 9 + 3 * 3) = sqrt(90) ≈<!-- notionvc: 882cf44c-3b17-428e-9c65-9940810216f1 --> 9.487。
|
||||
下标 = 1,长度 = 8,宽度 = 6。对角线长度 = sqrt(8 * 8 + 6 * 6) = sqrt(100) = 10。
|
||||
因此,下标为 1 的矩形对角线更长,所以返回面积 = 8 * 6 = 48。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>dimensions = [[3,4],[4,3]]
|
||||
<strong>输出:</strong>12
|
||||
<strong>解释:</strong>两个矩形的对角线长度相同,为 5,所以最大面积 = 12。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= dimensions.length <= 100</code></li>
|
||||
<li><code>dimensions[i].length == 2</code></li>
|
||||
<li><code>1 <= dimensions[i][0], dimensions[i][1] <= 100</code></li>
|
||||
</ul>
|
@ -0,0 +1,72 @@
|
||||
<p>给你一个下标从 <strong>0</strong> 开始的字符串 <code>s</code> 和一个整数 <code>k</code>。</p>
|
||||
|
||||
<p>你需要执行以下分割操作,直到字符串 <code>s </code>变为 <strong>空</strong>:</p>
|
||||
|
||||
<ul>
|
||||
<li>选择 <code>s</code> 的最长<strong>前缀</strong>,该前缀最多包含 <code>k </code>个 <strong>不同 </strong>字符。</li>
|
||||
<li><strong>删除 </strong>这个前缀,并将分割数量加一。如果有剩余字符,它们在 <code>s</code> 中保持原来的顺序。</li>
|
||||
</ul>
|
||||
|
||||
<p>执行操作之 <strong>前</strong> ,你可以将 <code>s</code> 中 <strong>至多一处 </strong>下标的对应字符更改为另一个小写英文字母。</p>
|
||||
|
||||
<p>在最优选择情形下改变至多一处下标对应字符后,用整数表示并返回操作结束时得到的最大分割数量。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "accca", k = 2
|
||||
<strong>输出:</strong>3
|
||||
<strong>解释:</strong>在此示例中,为了最大化得到的分割数量,可以将 s[2] 改为 'b'。
|
||||
s 变为 "acbca"。
|
||||
按照以下方式执行操作,直到 s 变为空:
|
||||
- 选择最长且至多包含 2 个不同字符的前缀,"<em><strong>ac</strong></em>bca"。
|
||||
- 删除该前缀,s 变为 "bca"。现在分割数量为 1。
|
||||
- 选择最长且至多包含 2 个不同字符的前缀,"<em><strong>bc</strong></em>a"。
|
||||
- 删除该前缀,s 变为 "a"。现在分割数量为 2。
|
||||
- 选择最长且至多包含 2 个不同字符的前缀,"<strong><em>a</em></strong>"。
|
||||
- 删除该前缀,s 变为空。现在分割数量为 3。
|
||||
因此,答案是 3。
|
||||
可以证明,分割数量不可能超过 3。</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "aabaab", k = 3
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>在此示例中,为了最大化得到的分割数量,可以保持 s 不变。
|
||||
按照以下方式执行操作,直到 s 变为空:
|
||||
- 选择最长且至多包含 3 个不同字符的前缀,"<em><strong>aabaab</strong></em>"。
|
||||
- 删除该前缀,s 变为空。现在分割数量为 1。
|
||||
因此,答案是 1。
|
||||
可以证明,分割数量不可能超过 1。</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "xxyz", k = 1
|
||||
<strong>输出:</strong>4
|
||||
<strong>解释:</strong>在此示例中,为了最大化得到的分割数量,可以将 s[1] 改为 'a'。
|
||||
s 变为 "xayz"。
|
||||
按照以下方式执行操作,直到 s 变为空:
|
||||
- 选择最长且至多包含 1 个不同字符的前缀,"<em><strong>x</strong></em>ayz"。
|
||||
- 删除该前缀,s 变为 "ayz"。现在分割数量为 1。
|
||||
- 选择最长且至多包含 1 个不同字符的前缀,"<em><strong>a</strong></em>yz"。
|
||||
- 删除该前缀,s 变为 "yz",现在分割数量为 2。
|
||||
- 选择最长且至多包含 1 个不同字符的前缀,"<em><strong>y</strong></em>z"。
|
||||
- 删除该前缀,s 变为 "z"。现在分割数量为 3。
|
||||
- 选择最且至多包含 1 个不同字符的前缀,"<em>z</em>"。
|
||||
- 删除该前缀,s 变为空。现在分割数量为 4。
|
||||
因此,答案是 4。
|
||||
可以证明,分割数量不可能超过 4。</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= s.length <= 10<sup>4</sup></code></li>
|
||||
<li><code>s</code> 只包含小写英文字母。</li>
|
||||
<li><code>1 <= k <= 26</code></li>
|
||||
</ul>
|
@ -0,0 +1,44 @@
|
||||
<p>给你一个仅由小写英文字母组成的字符串 <code>s</code> 。</p>
|
||||
|
||||
<p>如果一个字符串仅由单一字符组成,那么它被称为 <strong>特殊 </strong>字符串。例如,字符串 <code>"abc"</code> 不是特殊字符串,而字符串 <code>"ddd"</code>、<code>"zz"</code> 和 <code>"f"</code> 是特殊字符串。</p>
|
||||
|
||||
<p>返回在 <code>s</code> 中出现 <strong>至少三次 </strong>的<strong> 最长特殊子字符串 </strong>的长度,如果不存在出现至少三次的特殊子字符串,则返回 <code>-1</code> 。</p>
|
||||
|
||||
<p><strong>子字符串 </strong>是字符串中的一个连续<strong> 非空 </strong>字符序列。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "aaaa"
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>出现三次的最长特殊子字符串是 "aa" :子字符串 "<em><strong>aa</strong></em>aa"、"a<em><strong>aa</strong></em>a" 和 "aa<em><strong>aa</strong></em>"。
|
||||
可以证明最大长度是 2 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "abcdef"
|
||||
<strong>输出:</strong>-1
|
||||
<strong>解释:</strong>不存在出现至少三次的特殊子字符串。因此返回 -1 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "abcaba"
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>出现三次的最长特殊子字符串是 "a" :子字符串 "<em><strong>a</strong></em>bcaba"、"abc<em><strong>a</strong></em>ba" 和 "abcab<em><strong>a</strong></em>"。
|
||||
可以证明最大长度是 1 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>3 <= s.length <= 50</code></li>
|
||||
<li><code>s</code> 仅由小写英文字母组成。</li>
|
||||
</ul>
|
@ -0,0 +1,44 @@
|
||||
<p>给你一个仅由小写英文字母组成的字符串 <code>s</code> 。</p>
|
||||
|
||||
<p>如果一个字符串仅由单一字符组成,那么它被称为 <strong>特殊 </strong>字符串。例如,字符串 <code>"abc"</code> 不是特殊字符串,而字符串 <code>"ddd"</code>、<code>"zz"</code> 和 <code>"f"</code> 是特殊字符串。</p>
|
||||
|
||||
<p>返回在 <code>s</code> 中出现 <strong>至少三次 </strong>的<strong> 最长特殊子字符串 </strong>的长度,如果不存在出现至少三次的特殊子字符串,则返回 <code>-1</code> 。</p>
|
||||
|
||||
<p><strong>子字符串 </strong>是字符串中的一个连续<strong> 非空 </strong>字符序列。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "aaaa"
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>出现三次的最长特殊子字符串是 "aa" :子字符串 "<em><strong>aa</strong></em>aa"、"a<em><strong>aa</strong></em>a" 和 "aa<em><strong>aa</strong></em>"。
|
||||
可以证明最大长度是 2 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "abcdef"
|
||||
<strong>输出:</strong>-1
|
||||
<strong>解释:</strong>不存在出现至少三次的特殊子字符串。因此返回 -1 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>s = "abcaba"
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>出现三次的最长特殊子字符串是 "a" :子字符串 "<em><strong>a</strong></em>bcaba"、"abc<em><strong>a</strong></em>ba" 和 "abcab<em><strong>a</strong></em>"。
|
||||
可以证明最大长度是 1 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>3 <= s.length <= 5 * 10<sup>5</sup></code></li>
|
||||
<li><code>s</code> 仅由小写英文字母组成。</li>
|
||||
</ul>
|
@ -0,0 +1,50 @@
|
||||
<p>现有一个下标从 <strong>0</strong> 开始的 <code>8 x 8</code> 棋盘,上面有 <code>3</code> 枚棋子。</p>
|
||||
|
||||
<p>给你 <code>6</code> 个整数 <code>a</code> 、<code>b</code> 、<code>c</code> 、<code>d</code> 、<code>e</code> 和 <code>f</code> ,其中:</p>
|
||||
|
||||
<ul>
|
||||
<li><code>(a, b)</code> 表示白色车的位置。</li>
|
||||
<li><code>(c, d)</code> 表示白色象的位置。</li>
|
||||
<li><code>(e, f)</code> 表示黑皇后的位置。</li>
|
||||
</ul>
|
||||
|
||||
<p>假定你只能移动白色棋子,返回捕获黑皇后所需的<strong>最少</strong>移动次数。</p>
|
||||
|
||||
<p><strong>请注意</strong>:</p>
|
||||
|
||||
<ul>
|
||||
<li>车可以向垂直或水平方向移动任意数量的格子,但不能跳过其他棋子。</li>
|
||||
<li>象可以沿对角线方向移动任意数量的格子,但不能跳过其他棋子。</li>
|
||||
<li>如果车或象能移向皇后所在的格子,则认为它们可以捕获皇后。</li>
|
||||
<li>皇后不能移动。</li>
|
||||
</ul>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="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>输入:</strong>a = 1, b = 1, c = 8, d = 8, e = 2, f = 3
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>将白色车先移动到 (1, 3) ,然后移动到 (2, 3) 来捕获黑皇后,共需移动 2 次。
|
||||
由于起始时没有任何棋子正在攻击黑皇后,要想捕获黑皇后,移动次数不可能少于 2 次。
|
||||
</pre>
|
||||
|
||||
<p><strong class="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>输入:</strong>a = 5, b = 3, c = 3, d = 4, e = 5, f = 2
|
||||
<strong>输出:</strong>1
|
||||
<strong>解释:</strong>可以通过以下任一方式移动 1 次捕获黑皇后:
|
||||
- 将白色车移动到 (5, 2) 。
|
||||
- 将白色象移动到 (5, 2) 。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= a, b, c, d, e, f <= 8</code></li>
|
||||
<li>两枚棋子不会同时出现在同一个格子上。</li>
|
||||
</ul>
|
@ -0,0 +1,43 @@
|
||||
<p>给你一个<strong> 正整数 </strong>数组 <code>nums</code> 。</p>
|
||||
|
||||
<p>你需要检查是否可以从数组中选出 <strong>两个或更多 </strong>元素,满足这些元素的按位或运算( <code>OR</code>)结果的二进制表示中 <strong>至少</strong><strong> </strong>存在一个尾随零。</p>
|
||||
|
||||
<p>例如,数字 <code>5</code> 的二进制表示是 <code>"101"</code>,不存在尾随零,而数字 <code>4</code> 的二进制表示是 <code>"100"</code>,存在两个尾随零。</p>
|
||||
|
||||
<p>如果可以选择两个或更多元素,其按位或运算结果存在尾随零,返回 <code>true</code>;否则,返回<em> </em><code>false</code> 。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [1,2,3,4,5]
|
||||
<strong>输出:</strong>true
|
||||
<strong>解释:</strong>如果选择元素 2 和 4,按位或运算结果是 6,二进制表示为 "110" ,存在一个尾随零。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [2,4,8,16]
|
||||
<strong>输出:</strong>true
|
||||
<strong>解释:</strong>如果选择元素 2 和 4,按位或运算结果是 6,二进制表示为 "110",存在一个尾随零。
|
||||
其他按位或运算结果存在尾随零的可能选择方案包括:(2, 8), (2, 16), (4, 8), (4, 16), (8, 16), (2, 4, 8), (2, 4, 16), (2, 8, 16), (4, 8, 16), 以及 (2, 4, 8, 16) 。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums = [1,3,5,7,9]
|
||||
<strong>输出:</strong>false
|
||||
<strong>解释:</strong>不存在按位或运算结果存在尾随零的选择方案。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>2 <= nums.length <= 100</code></li>
|
||||
<li><code>1 <= nums[i] <= 100</code></li>
|
||||
</ul>
|
@ -0,0 +1,44 @@
|
||||
<p>给你两个下标从 <code>0</code> 开始的整数数组 <code>nums1</code> 和 <code>nums2</code> ,它们的长度都是偶数<code> n</code> 。</p>
|
||||
|
||||
<p>你必须从 <code>nums1</code> 中移除 <code>n / 2</code> 个元素,同时从 <code>nums2</code> 中也移除 <code>n / 2</code> 个元素。移除之后,你将 <code>nums1</code> 和 <code>nums2</code> 中剩下的元素插入到集合 <code>s</code> 中。</p>
|
||||
|
||||
<p>返回集合 <code>s</code>可能的<strong> 最多 </strong>包含多少元素。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums1 = [1,2,1,2], nums2 = [1,1,1,1]
|
||||
<strong>输出:</strong>2
|
||||
<strong>解释:</strong>从 nums1 和 nums2 中移除两个 1 。移除后,数组变为 nums1 = [2,2] 和 nums2 = [1,1] 。因此,s = {1,2} 。
|
||||
可以证明,在移除之后,集合 s 最多可以包含 2 个元素。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums1 = [1,2,3,4,5,6], nums2 = [2,3,2,3,2,3]
|
||||
<strong>输出:</strong>5
|
||||
<strong>解释:</strong>从 nums1 中移除 2、3 和 6 ,同时从 nums2 中移除两个 3 和一个 2 。移除后,数组变为 nums1 = [1,4,5] 和 nums2 = [2,3,2] 。因此,s = {1,2,3,4,5} 。
|
||||
可以证明,在移除之后,集合 s 最多可以包含 5 个元素。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>输入:</strong>nums1 = [1,1,2,2,3,3], nums2 = [4,4,5,5,6,6]
|
||||
<strong>输出:</strong>6
|
||||
<strong>解释:</strong>从 nums1 中移除 1、2 和 3 ,同时从 nums2 中移除 4、5 和 6 。移除后,数组变为 nums1 = [1,2,3] 和 nums2 = [4,5,6] 。因此,s = {1,2,3,4,5,6} 。
|
||||
可以证明,在移除之后,集合 s 最多可以包含 6 个元素。 </pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</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>是偶数。</li>
|
||||
<li><code>1 <= nums1[i], nums2[i] <= 10<sup>9</sup></code></li>
|
||||
</ul>
|
@ -0,0 +1,47 @@
|
||||
<p>给你三个整数 <code>start</code> ,<code>finish</code> 和 <code>limit</code> 。同时给你一个下标从 <strong>0</strong> 开始的字符串 <code>s</code> ,表示一个 <strong>正</strong> 整数。</p>
|
||||
|
||||
<p>如果一个 <strong>正</strong> 整数 <code>x</code> 末尾部分是 <code>s</code> (换句话说,<code>s</code> 是 <code>x</code> 的 <strong>后缀</strong>),且 <code>x</code> 中的每个数位至多是 <code>limit</code> ,那么我们称 <code>x</code> 是 <strong>强大的</strong> 。</p>
|
||||
|
||||
<p>请你返回区间 <code>[start..finish]</code> 内强大整数的 <strong>总数目</strong> 。</p>
|
||||
|
||||
<p>如果一个字符串 <code>x</code> 是 <code>y</code> 中某个下标开始(<strong>包括</strong> <code>0</code> ),到下标为 <code>y.length - 1</code> 结束的子字符串,那么我们称 <code>x</code> 是 <code>y</code> 的一个后缀。比方说,<code>25</code> 是 <code>5125</code> 的一个后缀,但不是 <code>512</code> 的后缀。</p>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong class="example">示例 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>start = 1, finish = 6000, limit = 4, s = "124"
|
||||
<b>输出:</b>5
|
||||
<b>解释:</b>区间 [1..6000] 内的强大数字为 124 ,1124 ,2124 ,3124 和 4124 。这些整数的各个数位都 <= 4 且 "124" 是它们的后缀。注意 5124 不是强大整数,因为第一个数位 5 大于 4 。
|
||||
这个区间内总共只有这 5 个强大整数。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>start = 15, finish = 215, limit = 6, s = "10"
|
||||
<b>输出:</b>2
|
||||
<b>解释:</b>区间 [15..215] 内的强大整数为 110 和 210 。这些整数的各个数位都 <= 6 且 "10" 是它们的后缀。
|
||||
这个区间总共只有这 2 个强大整数。
|
||||
</pre>
|
||||
|
||||
<p><strong class="example">示例 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<b>输入:</b>start = 1000, finish = 2000, limit = 4, s = "3000"
|
||||
<b>输出:</b>0
|
||||
<b>解释:</b>区间 [1000..2000] 内的整数都小于 3000 ,所以 "3000" 不可能是这个区间内任何整数的后缀。
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
|
||||
<p><strong>提示:</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> 数位中每个数字都小于等于 <code>limit</code> 。</li>
|
||||
<li><code>s</code> 不包含任何前导 0 。</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>
|
@ -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,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>
|
@ -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>
|
@ -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,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,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 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>
|
@ -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>
|
@ -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>
|
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>
|
Loading…
Reference in New Issue
Block a user