1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 10:38:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
程序员小墨 2023-08-11 23:36:00 +08:00
parent 4baa9b5a57
commit e171f2875e
131 changed files with 27244 additions and 14500 deletions

View File

@ -1,6 +1,6 @@
# 力扣题库(完整版)
> 最后更新日期: **2023.07.16**
> 最后更新日期: **2023.08.11**
>
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2907",
"questionFrontendId": "2804",
"categoryTitle": "JavaScript",
"boundTopicId": 2371139,
"title": "Array Prototype ForEach",
"titleSlug": "array-prototype-foreach",
"content": null,
"translatedTitle": "数组原型的 forEach 方法",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"38\", \"totalSubmission\": \"45\", \"totalAcceptedRaw\": 38, \"totalSubmissionRaw\": 45, \"acRate\": \"84.4%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "[1,2,3]\nfunction(val, i, arr){ arr[i] = val * 2 }\n{\"context\": true}",
"metaData": "{\n \"name\": \"foobar\",\n \"params\": [\n {\n \"name\": \"arr\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"callback\"\n },\n {\n \"type\": \"string\",\n \"name\": \"context\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "[1,2,3]\nfunction(val, i, arr){ arr[i] = val * 2 }\n{\"context\": true}\n[true, true, false, false]\nfunction(val, i, arr){ arr[i] = this }\n{\"context\": false}\n[true, true, false, false]\nfunction(val, i, arr){ arr[i] = !val }\n{\"context\": 5}",
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2861",
"questionFrontendId": "2794",
"categoryTitle": "JavaScript",
"boundTopicId": 2362408,
"title": "Create Object from Two Arrays",
"titleSlug": "create-object-from-two-arrays",
"content": null,
"translatedTitle": "从两个数组中创建对象",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"52\", \"totalSubmission\": \"73\", \"totalAcceptedRaw\": 52, \"totalSubmissionRaw\": 73, \"acRate\": \"71.2%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "[\"a\",\"b\",\"c\"]\n[1,2,3]",
"metaData": "{\n \"name\": \"createObject\",\n \"params\": [\n {\n \"name\": \"keysArr\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"valuesArr\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "[\"a\",\"b\",\"c\"]\n[1,2,3]\n[1,\"1\",false]\n[4,5,6]\n[]\n[]",
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2908",
"questionFrontendId": "2805",
"categoryTitle": "JavaScript",
"boundTopicId": 2371112,
"title": "Custom Interval",
"titleSlug": "custom-interval",
"content": null,
"translatedTitle": "自定义间隔",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"36\", \"totalSubmission\": \"41\", \"totalAcceptedRaw\": 36, \"totalSubmissionRaw\": 41, \"acRate\": \"87.8%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "50\n20\n225",
"metaData": "{\n \"name\": \"foobar\",\n \"params\": [\n {\n \"type\": \"integer\",\n \"name\": \"delay\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"period\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"stopTime\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "50\n20\n225\n20\n20\n150\n100\n200\n500",
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2901",
"questionFrontendId": "2803",
"categoryTitle": "JavaScript",
"boundTopicId": 2371142,
"title": "Factorial Generator",
"titleSlug": "factorial-generator",
"content": null,
"translatedTitle": "阶乘生成器",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"39\", \"totalSubmission\": \"44\", \"totalAcceptedRaw\": 39, \"totalSubmissionRaw\": 44, \"acRate\": \"88.6%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "5",
"metaData": "{\n \"name\": \"factorial\",\n \"params\": [\n {\n \"name\": \"n\",\n \"type\": \"integer\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "5\n2\n0",
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,68 @@
{
"data": {
"question": {
"questionId": "3002",
"questionFrontendId": "2783",
"categoryTitle": "Database",
"boundTopicId": 2352589,
"title": "Flight Occupancy and Waitlist Analysis",
"titleSlug": "flight-occupancy-and-waitlist-analysis",
"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\": \"75\", \"totalSubmission\": \"170\", \"totalAcceptedRaw\": 75, \"totalSubmissionRaw\": 170, \"acRate\": \"44.1%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1],[102,1],[103,1],[104,2],[105,2],[106,3],[107,3]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table if not exists Flights(flight_id int,capacity int)\",\n \"Create table if not exists Passengers (passenger_id int,flight_id int)\"\n ],\n \"mssql\": [\n \"Create table Flights(flight_id int,capacity int)\",\n \"Create table Passengers (passenger_id int,flight_id int)\"\n ],\n \"oraclesql\": [\n \"Create table Flights(flight_id int,capacity int)\",\n \"Create table Passengers (passenger_id int,flight_id int)\"\n ],\n \"database\": true,\n \"name\": \"waitlist_analysis\",\n \"pythondata\": [\n \"Flights = pd.DataFrame([], columns=['flight_id', 'capacity']).astype({'flight_id':'Int64', 'capacity':'Int64'})\",\n \"Passengers = pd.DataFrame([], columns=['passenger_id', 'flight_id']).astype({'passenger_id':'Int64', 'flight_id':'Int64'})\"\n ]\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if not exists Flights(flight_id int,capacity int)",
"Create table if not exists Passengers (passenger_id int,flight_id int)",
"Truncate table Flights",
"insert into Flights (flight_id, capacity) values ('1', '2')",
"insert into Flights (flight_id, capacity) values ('2', '2')",
"insert into Flights (flight_id, capacity) values ('3', '1')",
"Truncate table Passengers",
"insert into Passengers (passenger_id, flight_id) values ('101', '1')",
"insert into Passengers (passenger_id, flight_id) values ('102', '1')",
"insert into Passengers (passenger_id, flight_id) values ('103', '1')",
"insert into Passengers (passenger_id, flight_id) values ('104', '2')",
"insert into Passengers (passenger_id, flight_id) values ('105', '2')",
"insert into Passengers (passenger_id, flight_id) values ('106', '3')",
"insert into Passengers (passenger_id, flight_id) values ('107', '3')"
],
"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>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1],[102,1],[103,1],[104,2],[105,2],[106,3],[107,3]]}}",
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2898",
"questionFrontendId": "2795",
"categoryTitle": "JavaScript",
"boundTopicId": 2362395,
"title": "Parallel Execution of Promises for Individual Results Retrieval",
"titleSlug": "parallel-execution-of-promises-for-individual-results-retrieval",
"content": null,
"translatedTitle": "并行执行 Promise 以获取独有的结果",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"40\", \"totalSubmission\": \"44\", \"totalAcceptedRaw\": 40, \"totalSubmissionRaw\": 44, \"acRate\": \"90.9%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "[() => new Promise(resolve => setTimeout(() => resolve(15), 100))]",
"metaData": "{\n \"name\": \"promiseAllSettled\",\n \"params\": [\n {\n \"name\": \"functions\",\n \"type\": \"string\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "[() => new Promise(resolve => setTimeout(() => resolve(15), 100))]\n[() => new Promise(resolve => setTimeout(() => resolve(20), 100)), () => new Promise(resolve => setTimeout(() => resolve(15), 100))]\n[() => new Promise(resolve => setTimeout(() => resolve(30), 200)), () => new Promise((resolve, reject) => setTimeout(() => reject(\"Error\"), 100))]",
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2900",
"questionFrontendId": "2797",
"categoryTitle": "JavaScript",
"boundTopicId": 2362414,
"title": "Partial Function with Placeholders",
"titleSlug": "partial-function-with-placeholders",
"content": null,
"translatedTitle": "带有占位符的部分函数",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"46\", \"totalSubmission\": \"52\", \"totalAcceptedRaw\": 46, \"totalSubmissionRaw\": 52, \"acRate\": \"88.5%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "(...args) => args\n[2,4,6]\n[8,10]",
"metaData": "{\n \"name\": \"partial\",\n \"params\": [\n {\n \"name\": \"fn\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"args\"\n },\n {\n \"type\": \"string\",\n \"name\": \"restArgs\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "(...args) => args\n[2,4,6]\n[8,10]\n(...args) => args\n[1,2,\"_\",4,\"_\",6]\n[3,5]\n(a, b, c) => b + a - c\n[\"_\", 5]\n[5, 20]",
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,46 @@
{
"data": {
"question": {
"questionId": "2899",
"questionFrontendId": "2796",
"categoryTitle": "JavaScript",
"boundTopicId": 2362415,
"title": "Repeat String",
"titleSlug": "repeat-string",
"content": null,
"translatedTitle": "重复字符串",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"54\", \"totalSubmission\": \"59\", \"totalAcceptedRaw\": 54, \"totalSubmissionRaw\": 59, \"acRate\": \"91.5%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "\"hello\"\n2",
"metaData": "{\n \"name\": \"repeat\",\n \"params\": [\n {\n \"name\": \"str\",\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"times\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"envInfo": "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "\"hello\"\n2\n\"code\"\n3\n\"js\"\n1",
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,61 @@
{
"data": {
"question": {
"questionId": "3003",
"questionFrontendId": "2793",
"categoryTitle": "Database",
"boundTopicId": 2362110,
"title": "Status of Flight Tickets",
"titleSlug": "status-of-flight-tickets",
"content": null,
"translatedTitle": "航班机票状态",
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 0,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": null,
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"46\", \"totalSubmission\": \"106\", \"totalAcceptedRaw\": 46, \"totalSubmissionRaw\": 106, \"acRate\": \"43.4%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\",\"booking_time\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1,\"2023-07-10 16:30:00\"],[102,1,\"2023-07-10 17:45:00\"],[103,1,\"2023-07-10 12:00:00\"],[104,2,\"2023-07-05 13:23:00\"],[105,2,\"2023-07-05 09:00:00\"],[106,3,\"2023-07-08 11:10:00\"],[107,3,\"2023-07-08 09:10:00\"]]}}",
"metaData": "{\n \"mysql\": [\n \"Create table if not exists Flights(flight_id int,capacity int)\",\n \"Create table if not exists Passengers (passenger_id int,flight_id int,booking_time datetime)\"\n ],\n \"mssql\": [\n \"Create table Flights(flight_id int,capacity int)\",\n \"Create table Passengers (passenger_id int,flight_id int, booking_time datetime)\"\n ],\n \"oraclesql\": [\n \"Create table Flights(flight_id int,capacity int)\",\n \"Create table Passengers (passenger_id int,flight_id int, booking_time date)\",\n \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"\n ],\n \"database\": true,\n \"languages\": [\n \"mysql\",\n \"mssql\",\n \"oraclesql\"\n ]\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if not exists Flights(flight_id int,capacity int)",
"Create table if not exists Passengers (passenger_id int,flight_id int,booking_time datetime)",
"Truncate table Flights",
"insert into Flights (flight_id, capacity) values ('1', '2')",
"insert into Flights (flight_id, capacity) values ('2', '2')",
"insert into Flights (flight_id, capacity) values ('3', '1')",
"Truncate table Passengers",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('101', '1', '2023-07-10 16:30:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('102', '1', '2023-07-10 17:45:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('103', '1', '2023-07-10 12:00:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('104', '2', '2023-07-05 13:23:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('105', '2', '2023-07-05 09:00:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('106', '3', '2023-07-08 11:10:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('107', '3', '2023-07-08 09:10:00')"
],
"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\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\",\"booking_time\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1,\"2023-07-10 16:30:00\"],[102,1,\"2023-07-10 17:45:00\"],[103,1,\"2023-07-10 12:00:00\"],[104,2,\"2023-07-05 13:23:00\"],[105,2,\"2023-07-05 09:00:00\"],[106,3,\"2023-07-08 11:10:00\"],[107,3,\"2023-07-08 09:10:00\"]]}}",
"__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

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

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,48 @@
<p>给你一个下标从 <strong>0</strong>&nbsp;开始长度为 <code>n</code>&nbsp;的数组&nbsp;<code>nums</code>&nbsp;</p>
<p>每一秒,你可以对数组执行以下操作:</p>
<ul>
<li>对于范围在&nbsp;<code>[0, n - 1]</code>&nbsp;内的每一个下标&nbsp;<code>i</code>&nbsp;,将&nbsp;<code>nums[i]</code> 替换成&nbsp;<code>nums[i]</code>&nbsp;<code>nums[(i - 1 + n) % n]</code>&nbsp;或者&nbsp;<code>nums[(i + 1) % n]</code>&nbsp;三者之一。</li>
</ul>
<p><strong>注意</strong>,所有元素会被同时替换。</p>
<p>请你返回将数组 <code>nums</code>&nbsp;中所有元素变成相等元素所需要的 <strong>最少</strong>&nbsp;秒数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>nums = [1,2,1,2]
<b>输出:</b>1
<b>解释:</b>我们可以在 1 秒内将数组变成相等元素:
- 第 1 秒,将每个位置的元素分别变为 [nums[3],nums[1],nums[3],nums[3]] 。变化后nums = [2,2,2,2] 。
1 秒是将数组变成相等元素所需要的最少秒数。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>nums = [2,1,3,3,2]
<b>输出:</b>2
<b>解释:</b>我们可以在 2 秒内将数组变成相等元素:
- 第 1 秒,将每个位置的元素分别变为 [nums[0],nums[2],nums[2],nums[2],nums[3]] 。变化后nums = [2,3,3,3,3] 。
- 第 2 秒,将每个位置的元素分别变为 [nums[1],nums[1],nums[2],nums[3],nums[4]] 。变化后nums = [3,3,3,3,3] 。
2 秒是将数组变成相等元素所需要的最少秒数。
</pre>
<p><strong>示例 3</strong></p>
<pre><b>输入:</b>nums = [5,5,5,5]
<b>输出:</b>0
<b>解释:</b>不需要执行任何操作,因为一开始数组中的元素已经全部相等。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
</ul>

View File

@ -0,0 +1,43 @@
<p>给你两个长度相等下标从 <strong>0</strong>&nbsp;开始的整数数组&nbsp;<code>nums1</code>&nbsp;<code>nums2</code>&nbsp;。每一秒,对于所有下标&nbsp;<code>0 &lt;= i &lt; nums1.length</code>&nbsp;<code>nums1[i]</code>&nbsp;的值都增加&nbsp;<code>nums2[i]</code>&nbsp;。操作&nbsp;<strong>完成后</strong>&nbsp;,你可以进行如下操作:</p>
<ul>
<li>选择任一满足&nbsp;<code>0 &lt;= i &lt; nums1.length</code>&nbsp;的下标 <code>i</code>&nbsp;,并使&nbsp;<code>nums1[i] = 0</code>&nbsp;</li>
</ul>
<p>同时给你一个整数&nbsp;<code>x</code>&nbsp;</p>
<p>请你返回使&nbsp;<code>nums1</code>&nbsp;中所有元素之和 <strong>小于等于</strong>&nbsp;<code>x</code>&nbsp;所需要的 <strong>最少</strong>&nbsp;时间,如果无法实现,那么返回 <code>-1</code>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>nums1 = [1,2,3], nums2 = [1,2,3], x = 4
<b>输出:</b>3
<b>解释:</b>
第 1 秒,我们对 i = 0 进行操作,得到 nums1 = [0,2+2,3+3] = [0,4,6] 。
第 2 秒,我们对 i = 1 进行操作,得到 nums1 = [0+1,0,6+3] = [1,0,9] 。
第 3 秒,我们对 i = 2 进行操作,得到 nums1 = [1+1,0+2,0] = [2,2,0] 。
现在 nums1 的和为 4 。不存在更少次数的操作,所以我们返回 3 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>nums1 = [1,2,3], nums2 = [3,3,3], x = 4
<b>输出:</b>-1
<b>解释:</b>不管如何操作nums1 的和总是会超过 x 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums1.length &lt;= 10<sup>3</sup></code></li>
<li><code>1 &lt;= nums1[i] &lt;= 10<sup>3</sup></code></li>
<li><code>0 &lt;= nums2[i] &lt;= 10<sup>3</sup></code></li>
<li><code>nums1.length == nums2.length</code></li>
<li><code>0 &lt;= x &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,57 @@
<p>给你一个长度为 <code>n</code> 的数组 <code>nums</code> 和一个整数 <code>m</code> 。请你判断能否执行一系列操作,将数组拆分成 <code>n</code><strong>非空 </strong>数组。</p>
<p>在每一步操作中,你可以选择一个 <strong>长度至少为 2</strong> 的现有数组(之前步骤的结果) 并将其拆分成 <strong>2</strong> 个子数组,而得到的 <strong>每个</strong> 子数组,<strong>至少</strong> 需要满足以下条件之一:</p>
<ul>
<li>子数组的长度为 1 ,或者</li>
<li>子数组元素之和 <strong>大于或等于</strong>&nbsp; <code>m</code></li>
</ul>
<p>如果你可以将给定数组拆分成 <code>n</code> 个满足要求的数组,返回 <code>true</code><em> </em>;否则,返回 <code>false</code></p>
<p><strong>注意:</strong>子数组是数组中的一个连续非空元素序列。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>nums = [2, 2, 1], m = 4
<strong>输出:</strong>true
<strong>解释:</strong>
第 1 步,将数组 nums 拆分成 [2, 2] 和 [1] 。
第 2 步,将数组 [2, 2] 拆分成 [2] 和 [2] 。
因此,答案为 true 。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>nums = [2, 1, 3], m = 5
<strong>输出:</strong>false
<strong>解释:
</strong>存在两种不同的拆分方法:
第 1 种,将数组 nums 拆分成 [2, 1] 和 [3] 。
第 2 种,将数组 nums 拆分成 [2] 和 [1, 3] 。
然而,这两种方法都不满足题意。因此,答案为 false 。</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>nums = [2, 3, 3, 2, 3], m = 6
<strong>输出:</strong>true
<strong>解释:</strong>
第 1 步,将数组 nums 拆分成 [2, 3, 3, 2] 和 [3] 。
第 2 步,将数组 [2, 3, 3, 2] 拆分成 [2, 3, 3] 和 [2] 。
第 3 步,将数组 [2, 3, 3] 拆分成 [2] 和 [3, 3] 。
第 4 步,将数组 [3, 3] 拆分成 [3] 和 [3] 。
因此,答案为 true 。 </pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 100</code></li>
<li><code>1 &lt;= nums[i] &lt;= 100</code></li>
<li><code>1 &lt;= m &lt;= 200</code></li>
</ul>

View File

@ -0,0 +1,35 @@
给你三个字符串&nbsp;<code>a</code>&nbsp;<code>b</code>&nbsp;&nbsp;<code>c</code>&nbsp; 你的任务是找到长度&nbsp;<strong>最短</strong>&nbsp;的字符串,且这三个字符串都是它的 <strong>子字符串</strong>&nbsp;
<p>如果有多个这样的字符串,请你返回 <strong>字典序最小</strong>&nbsp;的一个。</p>
<p>请你返回满足题目要求的字符串。</p>
<p><strong>注意:</strong></p>
<ul>
<li>两个长度相同的字符串 <code>a</code>&nbsp;<code>b</code>&nbsp;,如果在第一个不相同的字符处,<code>a</code>&nbsp;的字母在字母表中比 <code>b</code>&nbsp;的字母 <strong>靠前</strong>&nbsp;,那么字符串&nbsp;<code>a</code>&nbsp;比字符串&nbsp;<code>b</code> <strong>字典序小</strong>&nbsp;</li>
<li><strong>子字符串</strong>&nbsp;是一个字符串中一段连续的字符序列。</li>
</ul>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><code><span style=""><b>输入:</b></span>a</code> = "abc", <code>b</code> = "bca", <code>c</code> = "aaa"
<b>输出:</b>"aaabca"
<b>解释:</b>字符串 "aaabca" 包含所有三个字符串a = ans[2...4] b = ans[3..5] c = ans[0..2] 。结果字符串的长度至少为 6 ,且"aaabca" 是字典序最小的一个。</pre>
<p><strong>示例 2</strong></p>
<pre><code><span style=""><b>输入:</b></span>a</code> = "ab", <code>b</code> = "ba", <code>c</code> = "aba"
<b>输出:</b>"aba"
<strong>解释:</strong>字符串 "aba" 包含所有三个字符串a = ans[0..1] b = ans[1..2] c = ans[0..2] 。由于 c 的长度为 3 ,结果字符串的长度至少为 3 。"aba" 是字典序最小的一个。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= a.length, b.length, c.length &lt;= 100</code></li>
<li><code>a</code>&nbsp;<code>b</code>&nbsp;<code>c</code>&nbsp;只包含小写英文字母。</li>
</ul>

View File

@ -0,0 +1,36 @@
<p>一开始,你的银行账户里有&nbsp;<code>100</code>&nbsp;块钱。</p>
<p>给你一个整数<code>purchaseAmount</code>&nbsp;,它表示你在一次购买中愿意支出的金额。</p>
<p>在一个商店里,你进行一次购买,实际支出的金额会向 <strong>最近</strong>&nbsp;&nbsp;<code>10</code>&nbsp;<strong>倍数</strong>&nbsp;取整。换句话说,你实际会支付一个&nbsp;<strong>非负</strong>&nbsp;金额&nbsp;<code>roundedAmount</code>&nbsp;,满足&nbsp;<code>roundedAmount</code>&nbsp;&nbsp;<code>10</code>&nbsp;的倍数且&nbsp;<code>abs(roundedAmount - purchaseAmount)</code>&nbsp;的值 <strong>最小</strong>&nbsp;</p>
<p>如果存在多于一个最接近的 <code>10</code>&nbsp;的倍数,<strong>较大的倍数</strong>&nbsp;是你的实际支出金额。</p>
<p>请你返回一个整数,表示你在愿意支出金额为<em>&nbsp;</em><code>purchaseAmount</code><em>&nbsp;</em>块钱的前提下,购买之后剩下的余额。</p>
<p><strong>注意:</strong> <code>0</code>&nbsp;也是&nbsp;<code>10</code>&nbsp;的倍数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>purchaseAmount = 9
<b>输出:</b>90
<b>解释:</b>这个例子中,最接近 9 的 10 的倍数是 10 。所以你的账户余额为 100 - 10 = 90 。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>purchaseAmount = 15
<b>输出:</b>80
<b>解释:</b>这个例子中,有 2 个最接近 15 的 10 的倍数10 和 20较大的数 20 是你的实际开销。
所以你的账户余额为 100 - 20 = 80 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>0 &lt;= purchaseAmount &lt;= 100</code></li>
</ul>

View File

@ -0,0 +1,41 @@
<p>给你一个下标从 <strong>0</strong> 开始、由正整数组成的数组 <code>nums</code></p>
<p>你可以在数组上执行下述操作 <strong>任意</strong> 次:</p>
<ul>
<li>选中一个同时满足&nbsp;<code>0 &lt;= i &lt; nums.length - 1</code><code>nums[i] &lt;= nums[i + 1]</code> 的整数 <code>i</code> 。将元素 <code>nums[i + 1]</code> 替换为 <code>nums[i] + nums[i + 1]</code> ,并从数组中删除元素 <code>nums[i]</code></li>
</ul>
<p>返回你可以从最终数组中获得的 <strong>最大</strong> 元素的值。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>nums = [2,3,7,9,3]
<strong>输出:</strong>21
<strong>解释:</strong>我们可以在数组上执行下述操作:
- 选中 i = 0 ,得到数组 nums = [<strong><em>5</em></strong>,7,9,3] 。
- 选中 i = 1 ,得到数组 nums = [5,<em><strong>16</strong></em>,3] 。
- 选中 i = 0 ,得到数组 nums = [<em><strong>21</strong></em>,3] 。
最终数组中的最大元素是 21 。可以证明我们无法获得更大的元素。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>nums = [5,3,3]
<strong>输出:</strong>11
<strong>解释:</strong>我们可以在数组上执行下述操作:
- 选中 i = 1 ,得到数组 nums = [5,<em><strong>6</strong></em>] 。
- 选中 i = 0 ,得到数组 nums = [<em><strong>11</strong></em>] 。
最终数组中只有一个元素,即 11 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,41 @@
<p>给你一个链表的头&nbsp;<code>head</code>&nbsp;,每个结点包含一个整数值。</p>
<p>在相邻结点之间,请你插入一个新的结点,结点值为这两个相邻结点值的 <strong>最大公约数</strong>&nbsp;</p>
<p>请你返回插入之后的链表。</p>
<p>两个数的 <strong>最大公约数</strong>&nbsp;是可以被两个数字整除的最大正整数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2023/07/18/ex1_copy.png" style="width: 641px; height: 181px;"></p>
<pre><b>输入:</b>head = [18,6,10,3]
<b>输出:</b>[18,6,6,2,10,1,3]
<b>解释:</b>第一幅图是一开始的链表,第二幅图是插入新结点后的图(蓝色结点为新插入结点)。
- 18 和 6 的最大公约数为 6 ,插入第一和第二个结点之间。
- 6 和 10 的最大公约数为 2 ,插入第二和第三个结点之间。
- 10 和 3 的最大公约数为 1 ,插入第三和第四个结点之间。
所有相邻结点之间都插入完毕,返回链表。
</pre>
<p><strong>示例 2</strong></p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2023/07/18/ex2_copy1.png" style="width: 51px; height: 191px;"></p>
<pre><b>输入:</b>head = [7]
<strong>输出:</strong>[7]
<b>解释:</b>第一幅图是一开始的链表,第二幅图是插入新结点后的图(蓝色结点为新插入结点)。
没有相邻结点,所以返回初始链表。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li>链表中结点数目在&nbsp;<code>[1, 5000]</code> 之间。</li>
<li><code>1 &lt;= Node.val &lt;= 1000</code></li>
</ul>

View File

@ -0,0 +1,61 @@
<p>给你一个长度为 <code>n</code> 的二维整数数组 <code>items</code> 和一个整数 <code>k</code></p>
<p><code>items[i] = [profit<sub>i</sub>, category<sub>i</sub>]</code>,其中 <code>profit<sub>i</sub></code><code>category<sub>i</sub></code> 分别表示第 <code>i</code> 个项目的利润和类别。</p>
<p>现定义&nbsp;<code>items</code><strong>子序列</strong><strong>优雅度</strong> 可以用 <code>total_profit + distinct_categories<sup>2</sup></code> 计算,其中 <code>total_profit</code> 是子序列中所有项目的利润总和,<code>distinct_categories</code> 是所选子序列所含的所有类别中不同类别的数量。</p>
<p>你的任务是从 <code>items</code> 所有长度为 <code>k</code> 的子序列中,找出 <strong>最大优雅度</strong></p>
<p>用整数形式表示并返回 <code>items</code> 中所有长度恰好为 <code>k</code> 的子序列的最大优雅度。</p>
<p><strong>注意:</strong>数组的子序列是经由原数组删除一些元素(可能不删除)而产生的新数组,且删除不改变其余元素相对顺序。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>items = [[3,2],[5,1],[10,1]], k = 2
<strong>输出:</strong>17
<strong>解释:
</strong>在这个例子中,我们需要选出长度为 2 的子序列。
其中一种方案是 items[0] = [3,2] 和 items[2] = [10,1] 。
子序列的总利润为 3 + 10 = 13 ,子序列包含 2 种不同类别 [2,1] 。
因此,优雅度为 13 + 2<sup>2</sup> = 17 ,可以证明 17 是可以获得的最大优雅度。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>items = [[3,1],[3,1],[2,2],[5,3]], k = 3
<strong>输出:</strong>19
<strong>解释:</strong>
在这个例子中,我们需要选出长度为 3 的子序列。
其中一种方案是 items[0] = [3,1] items[2] = [2,2] 和 items[3] = [5,3] 。
子序列的总利润为 3 + 2 + 5 = 10 ,子序列包含 3 种不同类别 [1, 2, 3] 。
因此,优雅度为 10 + 3<sup>2</sup> = 19 ,可以证明 19 是可以获得的最大优雅度。</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>items = [[1,1],[2,1],[3,1]], k = 3
<strong>输出:</strong>7
<strong>解释:
</strong>在这个例子中,我们需要选出长度为 3 的子序列。
我们需要选中所有项目。
子序列的总利润为 1 + 2 + 3 = 6子序列包含 1 种不同类别 [1] 。
因此,最大优雅度为 6 + 1<sup>2</sup> = 7 。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= items.length == n &lt;= 10<sup>5</sup></code></li>
<li><code>items[i].length == 2</code></li>
<li><code>items[i][0] == profit<sub>i</sub></code></li>
<li><code>items[i][1] == category<sub>i</sub></code></li>
<li><code>1 &lt;= profit<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= category<sub>i</sub> &lt;= n </code></li>
<li><code>1 &lt;= k &lt;= n</code></li>
</ul>

View File

@ -0,0 +1,35 @@
<p>给你两个 <strong></strong>&nbsp;整数&nbsp;<code>n</code>&nbsp;<code>x</code>&nbsp;</p>
<p>请你返回将<em>&nbsp;</em><code>n</code>&nbsp;表示成一些&nbsp;<strong>互不相同</strong>&nbsp;正整数的<em>&nbsp;</em><code>x</code>&nbsp;次幂之和的方案数。换句话说,你需要返回互不相同整数&nbsp;<code>[n<sub>1</sub>, n<sub>2</sub>, ..., n<sub>k</sub>]</code>&nbsp;的集合数目,满足&nbsp;<code>n = n<sub>1</sub><sup>x</sup> + n<sub>2</sub><sup>x</sup> + ... + n<sub>k</sub><sup>x</sup></code>&nbsp;</p>
<p>由于答案可能非常大,请你将它对&nbsp;<code>10<sup>9</sup> + 7</code>&nbsp;取余后返回。</p>
<p>比方说,<code>n = 160</code>&nbsp;<code>x = 3</code>&nbsp;,一个表示&nbsp;<code>n</code>&nbsp;的方法是&nbsp;<code>n = 2<sup>3</sup> + 3<sup>3</sup> + 5<sup>3</sup></code><sup>&nbsp;</sup></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>n = 10, x = 2
<b>输出:</b>1
<b>解释:</b>我们可以将 n 表示为n = 3<sup>2</sup> + 1<sup>2</sup> = 10 。
这是唯一将 10 表达成不同整数 2 次方之和的方案。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>n = 4, x = 1
<b>输出:</b>2
<b>解释:</b>我们可以将 n 按以下方案表示:
- n = 4<sup>1</sup> = 4 。
- n = 3<sup>1</sup> + 1<sup>1</sup> = 4 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 300</code></li>
<li><code>1 &lt;= x &lt;= 5</code></li>
</ul>

View File

@ -0,0 +1,37 @@
<p>给你一个下标从 <strong>0</strong>&nbsp;开始的字符串&nbsp;<code>s</code>&nbsp;,将&nbsp;<code>s</code>&nbsp;中的元素重新 <b>排列</b>&nbsp;得到新的字符串&nbsp;<code>t</code>&nbsp;,它满足:</p>
<ul>
<li>所有辅音字母都在原来的位置上。更正式的,如果满足&nbsp;<code>0 &lt;= i &lt; s.length</code>&nbsp;的下标 <code>i</code>&nbsp;处的&nbsp;<code>s[i]</code>&nbsp;是个辅音字母,那么&nbsp;<code>t[i] = s[i]</code>&nbsp;</li>
<li>元音字母都必须以他们的 <strong>ASCII</strong>&nbsp;值按 <strong>非递减</strong>&nbsp;顺序排列。更正式的,对于满足&nbsp;<code>0 &lt;= i &lt; j &lt; s.length</code>&nbsp;的下标 <code>i</code>&nbsp;<code>j</code>&nbsp; ,如果&nbsp;<code>s[i]</code>&nbsp;<code>s[j]</code>&nbsp;都是元音字母,那么&nbsp;<code>t[i]</code>&nbsp;的 ASCII 值不能大于&nbsp;<code>t[j]</code>&nbsp;的 ASCII 值。</li>
</ul>
<p>请你返回结果字母串。</p>
<p>元音字母为&nbsp;<code>'a'</code>&nbsp;<code>'e'</code>&nbsp;<code>'i'</code>&nbsp;<code>'o'</code>&nbsp;&nbsp;<code>'u'</code>&nbsp;,它们可能是小写字母也可能是大写字母,辅音字母是除了这 5 个字母以外的所有字母。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<b>输入:</b>s = "lEetcOde"
<b>输出:</b>"lEOtcede"
<b>解释:</b>'E' 'O' 和 'e' 是 s 中的元音字母,'l' 't' 'c' 和 'd' 是所有的辅音。将元音字母按照 ASCII 值排序,辅音字母留在原地。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<b>输入:</b>s = "lYmpH"
<b>输出:</b>"lYmpH"
<b>解释:</b>s 中没有元音字母s 中都为辅音字母),所以我们返回 "lYmpH" 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
<li><code>s</code>&nbsp;只包含英语字母表中的 <strong>大写&nbsp;</strong><strong>小写&nbsp;</strong>字母。</li>
</ul>

View File

@ -0,0 +1,59 @@
<p>给你一个下标从 <strong>0</strong> 开始、大小为 <code>n x n</code> 的二维矩阵 <code>grid</code> ,其中 <code>(r, c)</code> 表示:</p>
<ul>
<li>如果 <code>grid[r][c] = 1</code> ,则表示一个存在小偷的单元格</li>
<li>如果 <code>grid[r][c] = 0</code> ,则表示一个空单元格</li>
</ul>
<p>你最开始位于单元格 <code>(0, 0)</code> 。在一步移动中,你可以移动到矩阵中的任一相邻单元格,包括存在小偷的单元格。</p>
<p>矩阵中路径的 <strong>安全系数</strong> 定义为:从路径中任一单元格到矩阵中任一小偷所在单元格的 <strong>最小</strong> 曼哈顿距离。</p>
<p>返回所有通向单元格<em> </em><code>(n - 1, n - 1)</code> 的路径中的 <strong>最大安全系数</strong></p>
<p>单元格 <code>(r, c)</code> 的某个 <strong>相邻</strong> 单元格,是指在矩阵中存在的 <code>(r, c + 1)</code><code>(r, c - 1)</code><code>(r + 1, c)</code><code>(r - 1, c)</code> 之一。</p>
<p>两个单元格 <code>(a, b)</code><code>(x, y)</code> 之间的 <strong>曼哈顿距离</strong> 等于 <code>| a - x | + | b - y |</code> ,其中 <code>|val|</code> 表示 <code>val</code> 的绝对值。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/02/example1.png" style="width: 362px; height: 242px;" />
<pre>
<strong>输入:</strong>grid = [[1,0,0],[0,0,0],[0,0,1]]
<strong>输出:</strong>0
<strong>解释:</strong>从 (0, 0) 到 (n - 1, n - 1) 的每条路径都经过存在小偷的单元格 (0, 0) 和 (n - 1, n - 1) 。
</pre>
<p><strong>示例 2</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/02/example2.png" style="width: 362px; height: 242px;" />
<pre>
<strong>输入:</strong>grid = [[0,0,1],[0,0,0],[0,0,0]]
<strong>输出:</strong>2
<strong>解释:</strong>
上图所示路径的安全系数为 2
- 该路径上距离小偷所在单元格02最近的单元格是00。它们之间的曼哈顿距离为 | 0 - 0 | + | 0 - 2 | = 2 。
可以证明,不存在安全系数更高的其他路径。
</pre>
<p><strong>示例 3</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/02/example3.png" style="width: 362px; height: 242px;" />
<pre>
<strong>输入:</strong>grid = [[0,0,0,1],[0,0,0,0],[0,0,0,0],[1,0,0,0]]
<strong>输出:</strong>2
<strong>解释:</strong>
上图所示路径的安全系数为 2
- 该路径上距离小偷所在单元格03最近的单元格是12。它们之间的曼哈顿距离为 | 0 - 1 | + | 3 - 2 | = 2 。
- 该路径上距离小偷所在单元格30最近的单元格是32。它们之间的曼哈顿距离为 | 3 - 3 | + | 0 - 2 | = 2 。
可以证明,不存在安全系数更高的其他路径。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= grid.length == n &lt;= 400</code></li>
<li><code>grid[i].length == n</code></li>
<li><code>grid[i][j]</code><code>0</code><code>1</code></li>
<li><code>grid</code> 至少存在一个小偷</li>
</ul>

View File

@ -0,0 +1,57 @@
<p>给你一个字符串数组 <code>words</code> 和一个字符 <code>separator</code> ,请你按 <code>separator</code> 拆分 <code>words</code> 中的每个字符串。</p>
<p>返回一个由拆分后的新字符串组成的字符串数组,<strong>不包括空字符串</strong></p>
<p><strong>注意</strong></p>
<ul>
<li><code>separator</code> 用于决定拆分发生的位置,但它不包含在结果字符串中。</li>
<li>拆分可能形成两个以上的字符串。</li>
<li>结果字符串必须保持初始相同的先后顺序。</li>
</ul>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<strong>输入:</strong>words = ["one.two.three","four.five","six"], separator = "."
<strong>输出:</strong>["one","two","three","four","five","six"]
<strong>解释:</strong>在本示例中,我们进行下述拆分:
"one.two.three" 拆分为 "one", "two", "three"
"four.five" 拆分为 "four", "five"
"six" 拆分为 "six"
因此,结果数组为 ["one","two","three","four","five","six"] 。</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>words = ["$easy$","$problem$"], separator = "$"
<strong>输出:</strong>["easy","problem"]
<strong>解释:</strong>在本示例中,我们进行下述拆分:
"$easy$" 拆分为 "easy"(不包括空字符串)
"$problem$" 拆分为 "problem"(不包括空字符串)
因此,结果数组为 ["easy","problem"] 。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<strong>输入:</strong>words = ["|||"], separator = "|"
<strong>输出:</strong>[]
<strong>解释:</strong>在本示例中,"|||" 的拆分结果将只包含一些空字符串,所以我们返回一个空数组 [] 。 </pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= words.length &lt;= 100</code></li>
<li><code>1 &lt;= words[i].length &lt;= 20</code></li>
<li><code>words[i]</code> 中的字符要么是小写英文字母,要么就是字符串 <code>".,|$#@"</code> 中的字符(不包括引号)</li>
<li><code>separator</code> 是字符串 <code>".,|$#@"</code> 中的某个字符(不包括引号)</li>
</ul>

View File

@ -0,0 +1,46 @@
<p>你的笔记本键盘存在故障,每当你在上面输入字符 <code>'i'</code> 时,它会反转你所写的字符串。而输入其他字符则可以正常工作。</p>
<p>给你一个下标从 <strong>0</strong> 开始的字符串 <code>s</code> ,请你用故障键盘依次输入每个字符。</p>
<p>返回最终笔记本屏幕上输出的字符串。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>s = "string"
<strong>输出:</strong>"rtsng"
<strong>解释:</strong>
输入第 1 个字符后,屏幕上的文本是:"s" 。
输入第 2 个字符后,屏幕上的文本是:"st" 。
输入第 3 个字符后,屏幕上的文本是:"str" 。
因为第 4 个字符是 'i' ,屏幕上的文本被反转,变成 "rts" 。
输入第 5 个字符后,屏幕上的文本是:"rtsn" 。
输入第 6 个字符后,屏幕上的文本是: "rtsng" 。
因此,返回 "rtsng" 。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>s = "poiinter"
<strong>输出:</strong>"ponter"
<strong>解释:</strong>
输入第 1 个字符后,屏幕上的文本是:"p" 。
输入第 2 个字符后,屏幕上的文本是:"po" 。
因为第 3 个字符是 'i' ,屏幕上的文本被反转,变成 "op" 。
因为第 4 个字符是 'i' ,屏幕上的文本被反转,变成 "po" 。
输入第 5 个字符后,屏幕上的文本是:"pon" 。
输入第 6 个字符后,屏幕上的文本是:"pont" 。
输入第 7 个字符后,屏幕上的文本是:"ponte" 。
输入第 8 个字符后,屏幕上的文本是:"ponter" 。
因此,返回 "ponter" 。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 100</code></li>
<li><code>s</code> 由小写英文字母组成</li>
<li><code>s[0] != 'i'</code></li>
</ul>

View File

@ -0,0 +1,44 @@
<p>给你一棵 <strong></strong>(即,一个连通、无向且无环的图),<strong></strong> 节点为 <code>0</code> ,由编号从 <code>0</code><code>n - 1</code><code>n</code> 个节点组成。这棵树用一个长度为 <code>n</code> 、下标从 <strong>0</strong> 开始的数组 <code>parent</code> 表示,其中 <code>parent[i]</code> 为节点 <code>i</code> 的父节点,由于节点 <code>0</code> 为根节点,所以 <code>parent[0] == -1</code></p>
<p>另给你一个长度为 <code>n</code> 的字符串 <code>s</code> ,其中 <code>s[i]</code> 是分配给 <code>i</code><code>parent[i]</code> 之间的边的字符。<code>s[0]</code> 可以忽略。</p>
<p>找出满足 <code>u &lt; v</code> ,且从 <code>u</code><code>v</code> 的路径上分配的字符可以 <strong>重新排列</strong> 形成 <strong>回文</strong> 的所有节点对&nbsp;<code>(u, v)</code> ,并返回节点对的数目。</p>
<p>如果一个字符串正着读和反着读都相同,那么这个字符串就是一个 <strong>回文</strong></p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2023/07/15/treedrawio-8drawio.png" style="width: 281px; height: 181px;" /></p>
<pre>
<strong>输入:</strong>parent = [-1,0,0,1,1,2], s = "acaabc"
<strong>输出:</strong>8
<strong>解释:</strong>符合题目要求的节点对分别是:
- (0,1)、(0,2)、(1,3)、(1,4) 和 (2,5) ,路径上只有一个字符,满足回文定义。
- (2,3),路径上字符形成的字符串是 "aca" ,满足回文定义。
- (1,5),路径上字符形成的字符串是 "cac" ,满足回文定义。
- (3,5),路径上字符形成的字符串是 "acac" ,可以重排形成回文 "acca" 。
</pre>
<p><strong>示例 2</strong></p>
<pre>
<strong>输入:</strong>parent = [-1,0,0,0,0], s = "aaaaa"
<strong>输出:</strong>10
<strong>解释:</strong>任何满足 u &lt; v 的节点对 (u,v) 都符合题目要求。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>n == parent.length == s.length</code></li>
<li><code>1 &lt;= n &lt;= 10<sup>5</sup></code></li>
<li>对于所有 <code>i &gt;= 1</code> <code>0 &lt;= parent[i] &lt;= n - 1</code> 均成立</li>
<li><code>parent[0] == -1</code></li>
<li><code>parent</code> 表示一棵有效的树</li>
<li><code>s</code> 仅由小写英文字母组成</li>
</ul>

View File

@ -0,0 +1,44 @@
<p>给你一个整数数组&nbsp;<code>nums</code>&nbsp;,如果它是数组&nbsp;<code>base[n]</code>&nbsp;的一个排列,我们称它是个&nbsp;<strong></strong>&nbsp;数组。</p>
<p><code>base[n] = [1, 2, ..., n - 1, n, n]</code>&nbsp;(换句话说,它是一个长度为 <code>n + 1</code>&nbsp;且包含&nbsp;<code>1</code>&nbsp;&nbsp;<code>n - 1</code>&nbsp;恰好各一次,包含 <code>n</code>&nbsp; 两次的一个数组)。比方说,<code>base[1] = [1, 1]</code>&nbsp;<code>base[3] = [1, 2, 3, 3]</code>&nbsp;</p>
<p>如果数组是一个好数组,请你返回&nbsp;<code>true</code>&nbsp;,否则返回&nbsp;<code>false</code>&nbsp;</p>
<p><strong>注意:</strong>数组的排列是这些数字按任意顺序排布后重新得到的数组。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>nums = [2, 1, 3]
<b>输出:</b>false
<b>解释:</b>因为数组的最大元素是 3 ,唯一可以构成这个数组的 base[n] 对应的 n = 3 。但是 base[3] 有 4 个元素,但数组 nums 只有 3 个元素,所以无法得到 base[3] = [1, 2, 3, 3] 的排列,所以答案为 false 。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>nums = [1, 3, 3, 2]
<b>输出:</b>true
<b>解释:因为</b>数组的最大元素是 3 ,唯一可以构成这个数组的 base[n] 对应的 n = 3 ,可以看出数组是 base[3] = [1, 2, 3, 3] 的一个排列(交换 nums 中第二个和第四个元素)。所以答案为 true 。</pre>
<p><strong>示例 3</strong></p>
<pre><b>输入:</b>nums = [1, 1]
<b>输出:</b>true
<b>解释:</b>因为数组的最大元素是 1 ,唯一可以构成这个数组的 base[n] 对应的 n = 1可以看出数组是 base[1] = [1, 1] 的一个排列。所以答案为 true 。</pre>
<p><strong>示例 4</strong></p>
<pre><b>输入:</b>nums = [3, 4, 4, 1, 2, 1]
<b>输出:</b>false
<b>解释:</b>因为数组的最大元素是 4 ,唯一可以构成这个数组的 base[n] 对应的 n = 4 。但是 base[n] 有 5 个元素而 nums 有 6 个元素。所以答案为 false 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
<li><code>1 &lt;= num[i] &lt;= 200</code></li>
</ul>

View File

@ -0,0 +1,39 @@
<p>公司里共有 <code>n</code> 名员工,按从 <code>0</code><code>n - 1</code> 编号。每个员工 <code>i</code> 已经在公司工作了 <code>hours[i]</code> 小时。</p>
<p>公司要求每位员工工作&nbsp;<strong>至少</strong> <code>target</code> 小时。</p>
<p>给你一个下标从 <strong>0</strong> 开始、长度为 <code>n</code> 的非负整数数组 <code>hours</code> 和一个非负整数 <code>target</code></p>
<p>请你用整数表示并返回工作至少 <code>target</code> 小时的员工数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>hours = [0,1,2,3,4], target = 2
<strong>输出:</strong>3
<strong>解释:</strong>公司要求每位员工工作至少 2 小时。
- 员工 0 工作 0 小时,不满足要求。
- 员工 1 工作 1 小时,不满足要求。
- 员工 2 工作 2 小时,满足要求。
- 员工 3 工作 3 小时,满足要求。
- 员工 4 工作 4 小时,满足要求。
共有 3 位满足要求的员工。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>hours = [5,1,4,2,2], target = 6
<strong>输出:</strong>0
<strong>解释:</strong>公司要求每位员工工作至少 6 小时。
共有 0 位满足要求的员工。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= n == hours.length &lt;= 50</code></li>
<li><code>0 &lt;=&nbsp;hours[i], target &lt;= 10<sup>5</sup></code></li>
</ul>

View File

@ -0,0 +1,36 @@
<p>给你一个由 <strong></strong> 整数组成的数组 <code>nums</code></p>
<p>如果数组中的某个子数组满足下述条件,则称之为 <strong>完全子数组</strong> </p>
<ul>
<li>子数组中 <strong>不同</strong> 元素的数目等于整个数组不同元素的数目。</li>
</ul>
<p>返回数组中 <strong>完全子数组</strong> 的数目。</p>
<p><strong>子数组</strong> 是数组中的一个连续非空序列。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>nums = [1,3,1,2,2]
<strong>输出:</strong>4
<strong>解释:</strong>完全子数组有:[1,3,1,2]、[1,3,1,2,2]、[3,1,2] 和 [3,1,2,2] 。
</pre>
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>nums = [5,5,5,5]
<strong>输出:</strong>10
<strong>解释:</strong>数组仅由整数 5 组成,所以任意子数组都满足完全子数组的条件。子数组的总数为 10 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 1000</code></li>
<li><code>1 &lt;= nums[i] &lt;= 2000</code></li>
</ul>

View File

@ -0,0 +1,34 @@
<p>给你两个正整数&nbsp;<code>low</code>&nbsp;<code>high</code>&nbsp;,都用字符串表示,请你统计闭区间 <code>[low, high]</code>&nbsp;内的 <strong>步进数字</strong>&nbsp;数目。</p>
<p>如果一个整数相邻数位之间差的绝对值都 <strong>恰好</strong>&nbsp;<code>1</code>&nbsp;,那么这个数字被称为 <strong>步进数字</strong>&nbsp;</p>
<p>请你返回一个整数,表示闭区间&nbsp;<code>[low, high]</code>&nbsp;之间步进数字的数目。</p>
<p>由于答案可能很大,请你将它对&nbsp;<code>10<sup>9</sup> + 7</code>&nbsp;<strong>取余</strong>&nbsp;后返回。</p>
<p><b>注意:</b>步进数字不能有前导 0 。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>low = "1", high = "11"
<b>输出:</b>10
<strong>解释:</strong>区间 [1,11] 内的步进数字为 1 2 3 4 5 6 7 8 9 和 10 。总共有 10 个步进数字。所以输出为 10 。</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>low = "90", high = "101"
<b>输出:</b>2
<strong>解释:</strong>区间 [90,101] 内的步进数字为 98 和 101 。总共有 2 个步进数字。所以输出为 2 。</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= int(low) &lt;= int(high) &lt; 10<sup>100</sup></code></li>
<li><code>1 &lt;= low.length, high.length &lt;= 100</code></li>
<li><code>low</code>&nbsp;<code>high</code>&nbsp;只包含数字。</li>
<li><code>low</code>&nbsp;<code>high</code>&nbsp;都不含前导 0 。</li>
</ul>

View File

@ -0,0 +1,41 @@
<p>给你一个下标从 <strong>0</strong>&nbsp;开始的整数数组&nbsp;<code>nums</code>&nbsp;和一个正整数&nbsp;<code>x</code>&nbsp;</p>
<p><strong>一开始</strong>&nbsp;在数组的位置 <code>0</code>&nbsp;处,你可以按照下述规则访问数组中的其他位置:</p>
<ul>
<li>如果你当前在位置&nbsp;<code>i</code>&nbsp;,那么你可以移动到满足&nbsp;<code>i &lt; j</code>&nbsp;&nbsp;<strong>任意</strong>&nbsp;位置&nbsp;<code>j</code>&nbsp;</li>
<li>对于你访问的位置 <code>i</code>&nbsp;,你可以获得分数&nbsp;<code>nums[i]</code>&nbsp;</li>
<li>如果你从位置 <code>i</code>&nbsp;移动到位置 <code>j</code>&nbsp;&nbsp;<code>nums[i]</code>&nbsp;<code>nums[j]</code>&nbsp;<strong>奇偶性</strong>&nbsp;不同,那么你将失去分数&nbsp;<code>x</code>&nbsp;</li>
</ul>
<p>请你返回你能得到的 <strong>最大</strong>&nbsp;得分之和。</p>
<p><strong>注意</strong>&nbsp;,你一开始的分数为&nbsp;<code>nums[0]</code>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre><b>输入:</b>nums = [2,3,6,1,9,2], x = 5
<b>输出:</b>13
<b>解释:</b>我们可以按顺序访问数组中的位置0 -&gt; 2 -&gt; 3 -&gt; 4 。
对应位置的值为 2 6 1 和 9 。因为 6 和 1 的奇偶性不同,所以下标从 2 -&gt; 3 让你失去 x = 5 分。
总得分为2 + 6 + 1 + 9 - 5 = 13 。
</pre>
<p><strong>示例 2</strong></p>
<pre><b>输入:</b>nums = [2,4,6,8], x = 3
<b>输出:</b>20
<b>解释:</b>数组中的所有元素奇偶性都一样,所以我们可以将每个元素都访问一次,而且不会失去任何分数。
总得分为2 + 4 + 6 + 8 = 20 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>2 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i], x &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,59 @@
<p>给你一个下标从 <strong>0</strong> 开始、长度为 <code>n</code> 的数组 <code>usageLimits</code></p>
<p>你的任务是使用从 <code>0</code><code>n - 1</code> 的数字创建若干组,并确保每个数字 <code>i</code><strong>所有组</strong> 中使用的次数总共不超过 <code>usageLimits[i]</code> 次。此外,还必须满足以下条件:</p>
<ul>
<li>每个组必须由 <strong>不同</strong> 的数字组成,也就是说,单个组内不能存在重复的数字。</li>
<li>每个组(除了第一个)的长度必须 <strong>严格大于</strong> 前一个组。</li>
</ul>
<p>在满足所有条件的情况下,以整数形式返回可以创建的最大组数。</p>
<p>&nbsp;</p>
<p><strong>示例 1</strong></p>
<pre>
<code><strong>输入:</strong>usageLimits</code> = [1,2,5]
<strong>输出:</strong>3
<strong>解释:</strong>在这个示例中,我们可以使用 0 至多一次,使用 1 至多 2 次,使用 2 至多 5 次。
一种既能满足所有条件,又能创建最多组的方式是:
组 1 包含数字 [2] 。
组 2 包含数字 [1,2] 。
组 3 包含数字 [0,1,2] 。
可以证明能够创建的最大组数是 3 。
所以,输出是 3 。 </pre>
<p><strong>示例 2</strong></p>
<pre>
<code><strong>输入:</strong></code><code>usageLimits</code> = [2,1,2]
<strong>输出:</strong>2
<strong>解释:</strong>在这个示例中,我们可以使用 0 至多 2 次,使用 1 至多 1 次,使用 2 至多 2 次。
一种既能满足所有条件,又能创建最多组的方式是:
组 1 包含数字 [0] 。
组 2 包含数字 [1,2] 。
可以证明能够创建的最大组数是 2 。
所以,输出是 2 。
</pre>
<p><strong>示例 3</strong></p>
<pre>
<code><strong>输入:</strong></code><code>usageLimits</code> = [1,1]
<strong>输出:</strong>1
<strong>解释:</strong>在这个示例中,我们可以使用 0 和 1 至多 1 次。
一种既能满足所有条件,又能创建最多组的方式是:
组 1 包含数字 [0] 。
可以证明能够创建的最大组数是 1 。
所以,输出是 1 。
</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= usageLimits.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= usageLimits[i] &lt;= 10<sup>9</sup></code></li>
</ul>

View File

@ -0,0 +1,49 @@
<p>You are given a <strong>0-indexed</strong> array <code>nums</code> containing <code>n</code> integers.</p>
<p>At each second, you perform the following operation on the array:</p>
<ul>
<li>For every index <code>i</code> in the range <code>[0, n - 1]</code>, replace <code>nums[i]</code> with either <code>nums[i]</code>, <code>nums[(i - 1 + n) % n]</code>, or <code>nums[(i + 1) % n]</code>.</li>
</ul>
<p><strong>Note</strong> that all the elements get replaced simultaneously.</p>
<p>Return <em>the <strong>minimum</strong> number of seconds needed to make all elements in the array</em> <code>nums</code> <em>equal</em>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,2,1,2]
<strong>Output:</strong> 1
<strong>Explanation:</strong> We can equalize the array in 1 second in the following way:
- At 1<sup>st</sup> second, replace values at each index with [nums[3],nums[1],nums[3],nums[3]]. After replacement, nums = [2,2,2,2].
It can be proven that 1 second is the minimum amount of seconds needed for equalizing the array.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [2,1,3,3,2]
<strong>Output:</strong> 2
<strong>Explanation:</strong> We can equalize the array in 2 seconds in the following way:
- At 1<sup>st</sup> second, replace values at each index with [nums[0],nums[2],nums[2],nums[2],nums[3]]. After replacement, nums = [2,3,3,3,3].
- At 2<sup>nd</sup> second, replace values at each index with [nums[1],nums[1],nums[2],nums[3],nums[4]]. After replacement, nums = [3,3,3,3,3].
It can be proven that 2 seconds is the minimum amount of seconds needed for equalizing the array.
</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> nums = [5,5,5,5]
<strong>Output:</strong> 0
<strong>Explanation:</strong> We don&#39;t need to perform any operations as all elements in the initial array are the same.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>9</sup></code></li>
</ul>

View File

@ -0,0 +1,42 @@
<p>You are given two <strong>0-indexed</strong> integer arrays <code>nums1</code> and <code>nums2</code> of equal length. Every second, for all indices <code>0 &lt;= i &lt; nums1.length</code>, value of <code>nums1[i]</code> is incremented by <code>nums2[i]</code>. <strong>After</strong> this is done, you can do the following operation:</p>
<ul>
<li>Choose an index <code>0 &lt;= i &lt; nums1.length</code> and make <code>nums1[i] = 0</code>.</li>
</ul>
<p>You are also given an integer <code>x</code>.</p>
<p>Return <em>the <strong>minimum</strong> time in which you can make the sum of all elements of </em><code>nums1</code><em> to be<strong> less than or equal</strong> to </em><code>x</code>, <em>or </em><code>-1</code><em> if this is not possible.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums1 = [1,2,3], nums2 = [1,2,3], x = 4
<strong>Output:</strong> 3
<strong>Explanation:</strong>
For the 1st second, we apply the operation on i = 0. Therefore nums1 = [0,2+2,3+3] = [0,4,6].
For the 2nd second, we apply the operation on i = 1. Therefore nums1 = [0+1,0,6+3] = [1,0,9].
For the 3rd second, we apply the operation on i = 2. Therefore nums1 = [1+1,0+2,0] = [2,2,0].
Now sum of nums1 = 4. It can be shown that these operations are optimal, so we return 3.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums1 = [1,2,3], nums2 = [3,3,3], x = 4
<strong>Output:</strong> -1
<strong>Explanation:</strong> It can be shown that the sum of nums1 will always be greater than x, no matter which operations are performed.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code><font face="monospace">1 &lt;= nums1.length &lt;= 10<sup>3</sup></font></code></li>
<li><code>1 &lt;= nums1[i] &lt;= 10<sup>3</sup></code></li>
<li><code>0 &lt;= nums2[i] &lt;= 10<sup>3</sup></code></li>
<li><code>nums1.length == nums2.length</code></li>
<li><code>0 &lt;= x &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,44 @@
<p>You are given an array <code>nums</code> of length <code>n</code> and an integer <code>m</code>. You need to determine if it is possible to split the array into <code>n</code> <strong>non-empty</strong> arrays by performing a series of steps.</p>
<p>In each step, you can select an existing array (which may be the result of previous steps) with a length of <strong>at least two</strong> and split it into <strong>two </strong>subarrays, if, <strong>for each </strong>resulting subarray, <strong>at least</strong> one of the following holds:</p>
<ul>
<li>The length of the subarray is one, or</li>
<li>The sum of elements of the subarray is <strong>greater than or equal</strong> to <code>m</code>.</li>
</ul>
<p>Return <code>true</code><em> if you can split the given array into </em><code>n</code><em> arrays, otherwise return</em> <code>false</code>.</p>
<p><strong>Note:</strong> A subarray is <em>a contiguous non-empty sequence of elements within an array</em>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [2, 2, 1], m = 4
<strong>Output:</strong> true
<strong>Explanation:</strong> We can split the array into [2, 2] and [1] in the first step. Then, in the second step, we can split [2, 2] into [2] and [2]. As a result, the answer is true.</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [2, 1, 3], m = 5
<strong>Output:</strong> false
<strong>Explanation: </strong>We can try splitting the array in two different ways: the first way is to have [2, 1] and [3], and the second way is to have [2] and [1, 3]. However, both of these ways are not valid. So, the answer is false.</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> nums = [2, 3, 3, 2, 3], m = 6
<strong>Output:</strong> true
<strong>Explanation:</strong> We can split the array into [2, 3, 3, 2] and [3] in the first step. Then, in the second step, we can split [2, 3, 3, 2] into [2, 3, 3] and [2]. Then, in the third step, we can split [2, 3, 3] into [2] and [3, 3]. And in the last step we can split [3, 3] into [3] and [3]. As a result, the answer is true.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == nums.length &lt;= 100</code></li>
<li><code>1 &lt;= nums[i] &lt;= 100</code></li>
<li><code>1 &lt;= m &lt;= 200</code></li>
</ul>

View File

@ -0,0 +1,35 @@
Given three strings <code>a</code>, <code>b</code>, and <code>c</code>, your task is to find a string that has the<strong> minimum</strong> length and contains all three strings as <strong>substrings</strong>.
<p>If there are multiple such strings, return the<em> </em><strong>lexicographically<em> </em>smallest </strong>one.</p>
<p>Return <em>a string denoting the answer to the problem.</em></p>
<p><strong>Notes</strong></p>
<ul>
<li>A string <code>a</code> is <strong>lexicographically smaller</strong> than a string <code>b</code> (of the same length) if in the first position where <code>a</code> and <code>b</code> differ, string <code>a</code> has a letter that appears <strong>earlier </strong>in the alphabet than the corresponding letter in <code>b</code>.</li>
<li>A <strong>substring</strong> is a contiguous sequence of characters within a string.</li>
</ul>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> a = &quot;abc&quot;, b = &quot;bca&quot;, c = &quot;aaa&quot;
<strong>Output:</strong> &quot;aaabca&quot;
<strong>Explanation:</strong> We show that &quot;aaabca&quot; contains all the given strings: a = ans[2...4], b = ans[3..5], c = ans[0..2]. It can be shown that the length of the resulting string would be at least 6 and &quot;aaabca&quot; is the lexicographically smallest one.</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> a = &quot;ab&quot;, b = &quot;ba&quot;, c = &quot;aba&quot;
<strong>Output:</strong> &quot;aba&quot;
<strong>Explanation: </strong>We show that the string &quot;aba&quot; contains all the given strings: a = ans[0..1], b = ans[1..2], c = ans[0..2]. Since the length of c is 3, the length of the resulting string would be at least 3. It can be shown that &quot;aba&quot; is the lexicographically smallest one.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= a.length, b.length, c.length &lt;= 100</code></li>
<li><code>a</code>, <code>b</code>, <code>c</code> consist only of lowercase English letters.</li>
</ul>

View File

@ -0,0 +1,36 @@
<p>Initially, you have a bank account balance of <code>100</code> dollars.</p>
<p>You are given an integer <code>purchaseAmount</code> representing the amount you will spend on a purchase in dollars.</p>
<p>At the store where you will make the purchase, the purchase amount is rounded to the <strong>nearest multiple</strong> of <code>10</code>. In other words, you pay a <strong>non-negative</strong> amount, <code>roundedAmount</code>, such that <code>roundedAmount</code> is a multiple of <code>10</code> and <code>abs(roundedAmount - purchaseAmount)</code> is <strong>minimized</strong>.</p>
<p>If there is more than one nearest multiple of <code>10</code>, the <strong>largest multiple</strong> is chosen.</p>
<p>Return <em>an integer denoting your account balance after making a purchase worth </em><code>purchaseAmount</code><em> dollars from the store.</em></p>
<p><strong>Note:</strong> <code>0</code> is considered to be a multiple of <code>10</code> in this problem.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> purchaseAmount = 9
<strong>Output:</strong> 90
<strong>Explanation:</strong> In this example, the nearest multiple of 10 to 9 is 10. Hence, your account balance becomes 100 - 10 = 90.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> purchaseAmount = 15
<strong>Output:</strong> 80
<strong>Explanation:</strong> In this example, there are two nearest multiples of 10 to 15: 10 and 20. So, the larger multiple, 20, is chosen.
Hence, your account balance becomes 100 - 20 = 80.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>0 &lt;= purchaseAmount &lt;= 100</code></li>
</ul>

View File

@ -0,0 +1,41 @@
<p>You are given a <strong>0-indexed</strong> array <code>nums</code> consisting of positive integers.</p>
<p>You can do the following operation on the array <strong>any</strong> number of times:</p>
<ul>
<li>Choose an integer <code>i</code> such that <code>0 &lt;= i &lt; nums.length - 1</code> and <code>nums[i] &lt;= nums[i + 1]</code>. Replace the element <code>nums[i + 1]</code> with <code>nums[i] + nums[i + 1]</code> and delete the element <code>nums[i]</code> from the array.</li>
</ul>
<p>Return <em>the value of the <b>largest</b> element that you can possibly obtain in the final array.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [2,3,7,9,3]
<strong>Output:</strong> 21
<strong>Explanation:</strong> We can apply the following operations on the array:
- Choose i = 0. The resulting array will be nums = [<u>5</u>,7,9,3].
- Choose i = 1. The resulting array will be nums = [5,<u>16</u>,3].
- Choose i = 0. The resulting array will be nums = [<u>21</u>,3].
The largest element in the final array is 21. It can be shown that we cannot obtain a larger element.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [5,3,3]
<strong>Output:</strong> 11
<strong>Explanation:</strong> We can do the following operations on the array:
- Choose i = 1. The resulting array will be nums = [5,<u>6</u>].
- Choose i = 0. The resulting array will be nums = [<u>11</u>].
There is only one element in the final array, which is 11.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i] &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,37 @@
<p>Given the head of a linked list <code>head</code>, in which each node contains an integer value.</p>
<p>Between every pair of adjacent nodes, insert a new node with a value equal to the <strong>greatest common divisor</strong> of them.</p>
<p>Return <em>the linked list after insertion</em>.</p>
<p>The <strong>greatest common divisor</strong> of two numbers is the largest positive integer that evenly divides both numbers.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/18/ex1_copy.png" style="width: 641px; height: 181px;" />
<pre>
<strong>Input:</strong> head = [18,6,10,3]
<strong>Output:</strong> [18,6,6,2,10,1,3]
<strong>Explanation:</strong> The 1<sup>st</sup> diagram denotes the initial linked list and the 2<sup>nd</sup> diagram denotes the linked list after inserting the new nodes (nodes in blue are the inserted nodes).
- We insert the greatest common divisor of 18 and 6 = 6 between the 1<sup>st</sup> and the 2<sup>nd</sup> nodes.
- We insert the greatest common divisor of 6 and 10 = 2 between the 2<sup>nd</sup> and the 3<sup>rd</sup> nodes.
- We insert the greatest common divisor of 10 and 3 = 1 between the 3<sup>rd</sup> and the 4<sup>th</sup> nodes.
There are no more adjacent nodes, so we return the linked list.
</pre>
<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/18/ex2_copy1.png" style="width: 51px; height: 191px;" />
<pre>
<strong>Input:</strong> head = [7]
<strong>Output:</strong> [7]
<strong>Explanation:</strong> The 1<sup>st</sup> diagram denotes the initial linked list and the 2<sup>nd</sup> diagram denotes the linked list after inserting the new nodes.
There are no pairs of adjacent nodes, so we return the initial linked list.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li>The number of nodes in the list is in the range <code>[1, 5000]</code>.</li>
<li><code>1 &lt;= Node.val &lt;= 1000</code></li>
</ul>

View File

@ -0,0 +1,56 @@
<p>You are given a <strong>0-indexed</strong> 2D integer array <code>items</code> of length <code>n</code> and an integer <code>k</code>.</p>
<p><code>items[i] = [profit<sub>i</sub>, category<sub>i</sub>]</code>, where <code>profit<sub>i</sub></code> and <code>category<sub>i</sub></code> denote the profit and category of the <code>i<sup>th</sup></code> item respectively.</p>
<p>Let&#39;s define the <strong>elegance</strong> of a <strong>subsequence</strong> of <code>items</code> as <code>total_profit + distinct_categories<sup>2</sup></code>, where <code>total_profit</code> is the sum of all profits in the subsequence, and <code>distinct_categories</code> is the number of <strong>distinct</strong> categories from all the categories in the selected subsequence.</p>
<p>Your task is to find the <strong>maximum elegance</strong> from all subsequences of size <code>k</code> in <code>items</code>.</p>
<p>Return <em>an integer denoting the maximum elegance of a subsequence of </em><code>items</code><em> with size exactly </em><code>k</code>.</p>
<p><strong>Note:</strong> A subsequence of an array is a new array generated from the original array by deleting some elements (possibly none) without changing the remaining elements&#39; relative order.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> items = [[3,2],[5,1],[10,1]], k = 2
<strong>Output:</strong> 17
<strong>Explanation: </strong>In this example, we have to select a subsequence of size 2.
We can select items[0] = [3,2] and items[2] = [10,1].
The total profit in this subsequence is 3 + 10 = 13, and the subsequence contains 2 distinct categories [2,1].
Hence, the elegance is 13 + 2<sup>2</sup> = 17, and we can show that it is the maximum achievable elegance.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> items = [[3,1],[3,1],[2,2],[5,3]], k = 3
<strong>Output:</strong> 19
<strong>Explanation:</strong> In this example, we have to select a subsequence of size 3.
We can select items[0] = [3,1], items[2] = [2,2], and items[3] = [5,3].
The total profit in this subsequence is 3 + 2 + 5 = 10, and the subsequence contains 3 distinct categories [1,2,3].
Hence, the elegance is 10 + 3<sup>2</sup> = 19, and we can show that it is the maximum achievable elegance.</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> items = [[1,1],[2,1],[3,1]], k = 3
<strong>Output:</strong> 7
<strong>Explanation:</strong> In this example, we have to select a subsequence of size 3.
We should select all the items.
The total profit will be 1 + 2 + 3 = 6, and the subsequence contains 1 distinct category [1].
Hence, the maximum elegance is 6 + 1<sup>2</sup> = 7. </pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= items.length == n &lt;= 10<sup>5</sup></code></li>
<li><code>items[i].length == 2</code></li>
<li><code>items[i][0] == profit<sub>i</sub></code></li>
<li><code>items[i][1] == category<sub>i</sub></code></li>
<li><code>1 &lt;= profit<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= category<sub>i</sub> &lt;= n </code></li>
<li><code>1 &lt;= k &lt;= n</code></li>
</ul>

View File

@ -0,0 +1,35 @@
<p>Given two <strong>positive</strong> integers <code>n</code> and <code>x</code>.</p>
<p>Return <em>the number of ways </em><code>n</code><em> can be expressed as the sum of the </em><code>x<sup>th</sup></code><em> power of <strong>unique</strong> positive integers, in other words, the number of sets of unique integers </em><code>[n<sub>1</sub>, n<sub>2</sub>, ..., n<sub>k</sub>]</code><em> where </em><code>n = n<sub>1</sub><sup>x</sup> + n<sub>2</sub><sup>x</sup> + ... + n<sub>k</sub><sup>x</sup></code><em>.</em></p>
<p>Since the result can be very large, return it modulo <code>10<sup>9</sup> + 7</code>.</p>
<p>For example, if <code>n = 160</code> and <code>x = 3</code>, one way to express <code>n</code> is <code>n = 2<sup>3</sup> + 3<sup>3</sup> + 5<sup>3</sup></code>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> n = 10, x = 2
<strong>Output:</strong> 1
<strong>Explanation:</strong> We can express n as the following: n = 3<sup>2</sup> + 1<sup>2</sup> = 10.
It can be shown that it is the only way to express 10 as the sum of the 2<sup>nd</sup> power of unique integers.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> n = 4, x = 1
<strong>Output:</strong> 2
<strong>Explanation:</strong> We can express n in the following ways:
- n = 4<sup>1</sup> = 4.
- n = 3<sup>1</sup> + 1<sup>1</sup> = 4.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n &lt;= 300</code></li>
<li><code>1 &lt;= x &lt;= 5</code></li>
</ul>

View File

@ -0,0 +1,35 @@
<p>Given a <strong>0-indexed</strong> string <code>s</code>, <strong>permute</strong> <code>s</code> to get a new string <code>t</code> such that:</p>
<ul>
<li>All consonants remain in their original places. More formally, if there is an index <code>i</code> with <code>0 &lt;= i &lt; s.length</code> such that <code>s[i]</code> is a consonant, then <code>t[i] = s[i]</code>.</li>
<li>The vowels must be sorted in the <strong>nondecreasing</strong> order of their <strong>ASCII</strong> values. More formally, for pairs of indices <code>i</code>, <code>j</code> with <code>0 &lt;= i &lt; j &lt; s.length</code> such that <code>s[i]</code> and <code>s[j]</code> are vowels, then <code>t[i]</code> must not have a higher ASCII value than <code>t[j]</code>.</li>
</ul>
<p>Return <em>the resulting string</em>.</p>
<p>The vowels are <code>&#39;a&#39;</code>, <code>&#39;e&#39;</code>, <code>&#39;i&#39;</code>, <code>&#39;o&#39;</code>, and <code>&#39;u&#39;</code>, and they can appear in lowercase or uppercase. Consonants comprise all letters that are not vowels.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = &quot;lEetcOde&quot;
<strong>Output:</strong> &quot;lEOtcede&quot;
<strong>Explanation:</strong> &#39;E&#39;, &#39;O&#39;, and &#39;e&#39; are the vowels in s; &#39;l&#39;, &#39;t&#39;, &#39;c&#39;, and &#39;d&#39; are all consonants. The vowels are sorted according to their ASCII values, and the consonants remain in the same places.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> s = &quot;lYmpH&quot;
<strong>Output:</strong> &quot;lYmpH&quot;
<strong>Explanation:</strong> There are no vowels in s (all characters in s are consonants), so we return &quot;lYmpH&quot;.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
<li><code>s</code> consists only of letters of the&nbsp;English alphabet&nbsp;in <strong>uppercase and lowercase</strong>.</li>
</ul>

View File

@ -0,0 +1,56 @@
<p>You are given a <strong>0-indexed</strong> 2D matrix <code>grid</code> of size <code>n x n</code>, where <code>(r, c)</code> represents:</p>
<ul>
<li>A cell containing a thief if <code>grid[r][c] = 1</code></li>
<li>An empty cell if <code>grid[r][c] = 0</code></li>
</ul>
<p>You are initially positioned at cell <code>(0, 0)</code>. In one move, you can move to any adjacent cell in the grid, including cells containing thieves.</p>
<p>The <strong>safeness factor</strong> of a path on the grid is defined as the <strong>minimum</strong> manhattan distance from any cell in the path to any thief in the grid.</p>
<p>Return <em>the <strong>maximum safeness factor</strong> of all paths leading to cell </em><code>(n - 1, n - 1)</code><em>.</em></p>
<p>An <strong>adjacent</strong> cell of cell <code>(r, c)</code>, is one of the cells <code>(r, c + 1)</code>, <code>(r, c - 1)</code>, <code>(r + 1, c)</code> and <code>(r - 1, c)</code> if it exists.</p>
<p>The <strong>Manhattan distance</strong> between two cells <code>(a, b)</code> and <code>(x, y)</code> is equal to <code>|a - x| + |b - y|</code>, where <code>|val|</code> denotes the absolute value of val.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/02/example1.png" style="width: 362px; height: 242px;" />
<pre>
<strong>Input:</strong> grid = [[1,0,0],[0,0,0],[0,0,1]]
<strong>Output:</strong> 0
<strong>Explanation:</strong> All paths from (0, 0) to (n - 1, n - 1) go through the thieves in cells (0, 0) and (n - 1, n - 1).
</pre>
<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/02/example2.png" style="width: 362px; height: 242px;" />
<pre>
<strong>Input:</strong> grid = [[0,0,1],[0,0,0],[0,0,0]]
<strong>Output:</strong> 2
<strong>Explanation:</strong> The path depicted in the picture above has a safeness factor of 2 since:
- The closest cell of the path to the thief at cell (0, 2) is cell (0, 0). The distance between them is | 0 - 0 | + | 0 - 2 | = 2.
It can be shown that there are no other paths with a higher safeness factor.
</pre>
<p><strong class="example">Example 3:</strong></p>
<img alt="" src="https://assets.leetcode.com/uploads/2023/07/02/example3.png" style="width: 362px; height: 242px;" />
<pre>
<strong>Input:</strong> grid = [[0,0,0,1],[0,0,0,0],[0,0,0,0],[1,0,0,0]]
<strong>Output:</strong> 2
<strong>Explanation:</strong> The path depicted in the picture above has a safeness factor of 2 since:
- The closest cell of the path to the thief at cell (0, 3) is cell (1, 2). The distance between them is | 0 - 1 | + | 3 - 2 | = 2.
- The closest cell of the path to the thief at cell (3, 0) is cell (3, 2). The distance between them is | 3 - 3 | + | 0 - 2 | = 2.
It can be shown that there are no other paths with a higher safeness factor.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= grid.length == n &lt;= 400</code></li>
<li><code>grid[i].length == n</code></li>
<li><code>grid[i][j]</code> is either <code>0</code> or <code>1</code>.</li>
<li>There is at least one thief in the <code>grid</code>.</li>
</ul>

View File

@ -0,0 +1,55 @@
<p>Given an array of strings <code>words</code> and a character <code>separator</code>, <strong>split</strong> each string in <code>words</code> by <code>separator</code>.</p>
<p>Return <em>an array of strings containing the new strings formed after the splits, <strong>excluding empty strings</strong>.</em></p>
<p><strong>Notes</strong></p>
<ul>
<li><code>separator</code> is used to determine where the split should occur, but it is not included as part of the resulting strings.</li>
<li>A split may result in more than two strings.</li>
<li>The resulting strings must maintain the same order as they were initially given.</li>
</ul>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> words = [&quot;one.two.three&quot;,&quot;four.five&quot;,&quot;six&quot;], separator = &quot;.&quot;
<strong>Output:</strong> [&quot;one&quot;,&quot;two&quot;,&quot;three&quot;,&quot;four&quot;,&quot;five&quot;,&quot;six&quot;]
<strong>Explanation: </strong>In this example we split as follows:
&quot;one.two.three&quot; splits into &quot;one&quot;, &quot;two&quot;, &quot;three&quot;
&quot;four.five&quot; splits into &quot;four&quot;, &quot;five&quot;
&quot;six&quot; splits into &quot;six&quot;
Hence, the resulting array is [&quot;one&quot;,&quot;two&quot;,&quot;three&quot;,&quot;four&quot;,&quot;five&quot;,&quot;six&quot;].</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> words = [&quot;$easy$&quot;,&quot;$problem$&quot;], separator = &quot;$&quot;
<strong>Output:</strong> [&quot;easy&quot;,&quot;problem&quot;]
<strong>Explanation:</strong> In this example we split as follows:
&quot;$easy$&quot; splits into &quot;easy&quot; (excluding empty strings)
&quot;$problem$&quot; splits into &quot;problem&quot; (excluding empty strings)
Hence, the resulting array is [&quot;easy&quot;,&quot;problem&quot;].
</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> words = [&quot;|||&quot;], separator = &quot;|&quot;
<strong>Output:</strong> []
<strong>Explanation:</strong> In this example the resulting split of &quot;|||&quot; will contain only empty strings, so we return an empty array []. </pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= words.length &lt;= 100</code></li>
<li><code>1 &lt;= words[i].length &lt;= 20</code></li>
<li>characters in <code>words[i]</code> are either lowercase English letters or characters from the string <code>&quot;.,|$#@&quot;</code> (excluding the quotes)</li>
<li><code>separator</code> is a character from the string <code>&quot;.,|$#@&quot;</code> (excluding the quotes)</li>
</ul>

View File

@ -0,0 +1,46 @@
<p>Your laptop keyboard is faulty, and whenever you type a character <code>&#39;i&#39;</code> on it, it reverses the string that you have written. Typing other characters works as expected.</p>
<p>You are given a <strong>0-indexed</strong> string <code>s</code>, and you type each character of <code>s</code> using your faulty keyboard.</p>
<p>Return <em>the final string that will be present on your laptop screen.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> s = &quot;string&quot;
<strong>Output:</strong> &quot;rtsng&quot;
<strong>Explanation:</strong>
After typing first character, the text on the screen is &quot;s&quot;.
After the second character, the text is &quot;st&quot;.
After the third character, the text is &quot;str&quot;.
Since the fourth character is an &#39;i&#39;, the text gets reversed and becomes &quot;rts&quot;.
After the fifth character, the text is &quot;rtsn&quot;.
After the sixth character, the text is &quot;rtsng&quot;.
Therefore, we return &quot;rtsng&quot;.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> s = &quot;poiinter&quot;
<strong>Output:</strong> &quot;ponter&quot;
<strong>Explanation:</strong>
After the first character, the text on the screen is &quot;p&quot;.
After the second character, the text is &quot;po&quot;.
Since the third character you type is an &#39;i&#39;, the text gets reversed and becomes &quot;op&quot;.
Since the fourth character you type is an &#39;i&#39;, the text gets reversed and becomes &quot;po&quot;.
After the fifth character, the text is &quot;pon&quot;.
After the sixth character, the text is &quot;pont&quot;.
After the seventh character, the text is &quot;ponte&quot;.
After the eighth character, the text is &quot;ponter&quot;.
Therefore, we return &quot;ponter&quot;.</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 100</code></li>
<li><code>s</code> consists of lowercase English letters.</li>
<li><code>s[0] != &#39;i&#39;</code></li>
</ul>

View File

@ -0,0 +1,42 @@
<p>You are given a <strong>tree</strong> (i.e. a connected, undirected graph that has no cycles) <strong>rooted</strong> at node <code>0</code> consisting of <code>n</code> nodes numbered from <code>0</code> to <code>n - 1</code>. The tree is represented by a <strong>0-indexed</strong> array <code>parent</code> of size <code>n</code>, where <code>parent[i]</code> is the parent of node <code>i</code>. Since node <code>0</code> is the root, <code>parent[0] == -1</code>.</p>
<p>You are also given a string <code>s</code> of length <code>n</code>, where <code>s[i]</code> is the character assigned to the edge between <code>i</code> and <code>parent[i]</code>. <code>s[0]</code> can be ignored.</p>
<p>Return <em>the number of pairs of nodes </em><code>(u, v)</code><em> such that </em><code>u &lt; v</code><em> and the characters assigned to edges on the path from </em><code>u</code><em> to </em><code>v</code><em> can be <strong>rearranged</strong> to form a <strong>palindrome</strong></em>.</p>
<p>A string is a <strong>palindrome</strong> when it reads the same backwards as forwards.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2023/07/15/treedrawio-8drawio.png" style="width: 281px; height: 181px;" /></p>
<pre>
<strong>Input:</strong> parent = [-1,0,0,1,1,2], s = &quot;acaabc&quot;
<strong>Output:</strong> 8
<strong>Explanation:</strong> The valid pairs are:
- All the pairs (0,1), (0,2), (1,3), (1,4) and (2,5) result in one character which is always a palindrome.
- The pair (2,3) result in the string &quot;aca&quot; which is a palindrome.
- The pair (1,5) result in the string &quot;cac&quot; which is a palindrome.
- The pair (3,5) result in the string &quot;acac&quot; which can be rearranged into the palindrome &quot;acca&quot;.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> parent = [-1,0,0,0,0], s = &quot;aaaaa&quot;
<strong>Output:</strong> 10
<strong>Explanation:</strong> Any pair of nodes (u,v) where u &lt; v is valid.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>n == parent.length == s.length</code></li>
<li><code>1 &lt;= n &lt;= 10<sup>5</sup></code></li>
<li><code>0 &lt;= parent[i] &lt;= n - 1</code> for all <code>i &gt;= 1</code></li>
<li><code>parent[0] == -1</code></li>
<li><code>parent</code> represents a valid tree.</li>
<li><code>s</code> consists of only lowercase English letters.</li>
</ul>

View File

@ -0,0 +1,46 @@
<p>You are given an integer array <code>nums</code>. We consider an array <strong>good </strong>if it is a permutation of an array <code>base[n]</code>.</p>
<p><code>base[n] = [1, 2, ..., n - 1, n, n] </code>(in other words, it is an array of length <code>n + 1</code> which contains <code>1</code> to <code>n - 1 </code>exactly once, plus two occurrences of <code>n</code>). For example, <code>base[1] = [1, 1]</code> and<code> base[3] = [1, 2, 3, 3]</code>.</p>
<p>Return <code>true</code> <em>if the given array is good, otherwise return</em><em> </em><code>false</code>.</p>
<p><strong>Note: </strong>A permutation of integers represents an arrangement of these numbers.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [2, 1, 3]
<strong>Output:</strong> false
<strong>Explanation:</strong> Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. However, base[3] has four elements but array nums has three. Therefore, it can not be a permutation of base[3] = [1, 2, 3, 3]. So the answer is false.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [1, 3, 3, 2]
<strong>Output:</strong> true
<strong>Explanation:</strong> Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. It can be seen that nums is a permutation of base[3] = [1, 2, 3, 3] (by swapping the second and fourth elements in nums, we reach base[3]). Therefore, the answer is true.</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> nums = [1, 1]
<strong>Output:</strong> true
<strong>Explanation:</strong> Since the maximum element of the array is 1, the only candidate n for which this array could be a permutation of base[n], is n = 1. It can be seen that nums is a permutation of base[1] = [1, 1]. Therefore, the answer is true.</pre>
<p><strong class="example">Example 4:</strong></p>
<pre>
<strong>Input:</strong> nums = [3, 4, 4, 1, 2, 1]
<strong>Output:</strong> false
<strong>Explanation:</strong> Since the maximum element of the array is 4, the only candidate n for which this array could be a permutation of base[n], is n = 4. However, base[4] has five elements but array nums has six. Therefore, it can not be a permutation of base[4] = [1, 2, 3, 4, 4]. So the answer is false.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 100</code></li>
<li><code>1 &lt;= num[i] &lt;= 200</code></li>
</ul>

View File

@ -0,0 +1,39 @@
<p>There are <code>n</code> employees in a company, numbered from <code>0</code> to <code>n - 1</code>. Each employee <code>i</code> has worked for <code>hours[i]</code> hours in the company.</p>
<p>The company requires each employee to work for <strong>at least</strong> <code>target</code> hours.</p>
<p>You are given a <strong>0-indexed</strong> array of non-negative integers <code>hours</code> of length <code>n</code> and a non-negative integer <code>target</code>.</p>
<p>Return <em>the integer denoting the number of employees who worked at least</em> <code>target</code> <em>hours</em>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> hours = [0,1,2,3,4], target = 2
<strong>Output:</strong> 3
<strong>Explanation:</strong> The company wants each employee to work for at least 2 hours.
- Employee 0 worked for 0 hours and didn&#39;t meet the target.
- Employee 1 worked for 1 hours and didn&#39;t meet the target.
- Employee 2 worked for 2 hours and met the target.
- Employee 3 worked for 3 hours and met the target.
- Employee 4 worked for 4 hours and met the target.
There are 3 employees who met the target.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> hours = [5,1,4,2,2], target = 6
<strong>Output:</strong> 0
<strong>Explanation:</strong> The company wants each employee to work for at least 6 hours.
There are 0 employees who met the target.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n == hours.length &lt;= 50</code></li>
<li><code>0 &lt;=&nbsp;hours[i], target &lt;= 10<sup>5</sup></code></li>
</ul>

View File

@ -0,0 +1,36 @@
<p>You are given an array <code>nums</code> consisting of <strong>positive</strong> integers.</p>
<p>We call a subarray of an array <strong>complete</strong> if the following condition is satisfied:</p>
<ul>
<li>The number of <strong>distinct</strong> elements in the subarray is equal to the number of distinct elements in the whole array.</li>
</ul>
<p>Return <em>the number of <strong>complete</strong> subarrays</em>.</p>
<p>A <strong>subarray</strong> is a contiguous non-empty part of an array.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [1,3,1,2,2]
<strong>Output:</strong> 4
<strong>Explanation:</strong> The complete subarrays are the following: [1,3,1,2], [1,3,1,2,2], [3,1,2] and [3,1,2,2].
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [5,5,5,5]
<strong>Output:</strong> 10
<strong>Explanation:</strong> The array consists only of the integer 5, so any subarray is complete. The number of subarrays that we can choose is 10.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= nums.length &lt;= 1000</code></li>
<li><code>1 &lt;= nums[i] &lt;= 2000</code></li>
</ul>

View File

@ -0,0 +1,34 @@
<p>Given two positive integers <code>low</code> and <code>high</code> represented as strings, find the count of <strong>stepping numbers</strong> in the inclusive range <code>[low, high]</code>.</p>
<p>A <strong>stepping number</strong> is an integer such that all of its adjacent digits have an absolute difference of <strong>exactly</strong> <code>1</code>.</p>
<p>Return <em>an integer denoting the count of stepping numbers in the inclusive range</em> <code>[low, high]</code><em>. </em></p>
<p>Since the answer may be very large, return it <strong>modulo</strong> <code>10<sup>9</sup> + 7</code>.</p>
<p><strong>Note:</strong> A stepping number should not have a leading zero.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> low = &quot;1&quot;, high = &quot;11&quot;
<strong>Output:</strong> 10
<strong>Explanation: </strong>The stepping numbers in the range [1,11] are 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. There are a total of 10 stepping numbers in the range. Hence, the output is 10.</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> low = &quot;90&quot;, high = &quot;101&quot;
<strong>Output:</strong> 2
<strong>Explanation: </strong>The stepping numbers in the range [90,101] are 98 and 101. There are a total of 2 stepping numbers in the range. Hence, the output is 2. </pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= int(low) &lt;= int(high) &lt; 10<sup>100</sup></code></li>
<li><code>1 &lt;= low.length, high.length &lt;= 100</code></li>
<li><code>low</code> and <code>high</code> consist of only digits.</li>
<li><code>low</code> and <code>high</code> don&#39;t have any leading zeros.</li>
</ul>

View File

@ -0,0 +1,41 @@
<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> and a positive integer <code>x</code>.</p>
<p>You are <strong>initially</strong> at position <code>0</code> in the array and you can visit other positions according to the following rules:</p>
<ul>
<li>If you are currently in position <code>i</code>, then you can move to <strong>any</strong> position <code>j</code> such that <code>i &lt; j</code>.</li>
<li>For each position <code>i</code> that you visit, you get a score of <code>nums[i]</code>.</li>
<li>If you move from a position <code>i</code> to a position <code>j</code> and the <strong>parities</strong> of <code>nums[i]</code> and <code>nums[j]</code> differ, then you lose a score of <code>x</code>.</li>
</ul>
<p>Return <em>the <strong>maximum</strong> total score you can get</em>.</p>
<p><strong>Note</strong> that initially you have <code>nums[0]</code> points.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> nums = [2,3,6,1,9,2], x = 5
<strong>Output:</strong> 13
<strong>Explanation:</strong> We can visit the following positions in the array: 0 -&gt; 2 -&gt; 3 -&gt; 4.
The corresponding values are 2, 6, 1 and 9. Since the integers 6 and 1 have different parities, the move 2 -&gt; 3 will make you lose a score of x = 5.
The total score will be: 2 + 6 + 1 + 9 - 5 = 13.
</pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> nums = [2,4,6,8], x = 3
<strong>Output:</strong> 20
<strong>Explanation:</strong> All the integers in the array have the same parities, so we can visit all of them without losing any score.
The total score is: 2 + 4 + 6 + 8 = 20.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums[i], x &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,57 @@
<p>You are given a <strong>0-indexed</strong> array <code>usageLimits</code> of length <code>n</code>.</p>
<p>Your task is to create <strong>groups</strong> using numbers from <code>0</code> to <code>n - 1</code>, ensuring that each number, <code>i</code>, is used no more than <code>usageLimits[i]</code> times in total <strong>across all groups</strong>. You must also satisfy the following conditions:</p>
<ul>
<li>Each group must consist of <strong>distinct </strong>numbers, meaning that no duplicate numbers are allowed within a single group.</li>
<li>Each group (except the first one) must have a length <strong>strictly greater</strong> than the previous group.</li>
</ul>
<p>Return <em>an integer denoting the <strong>maximum</strong> number of groups you can create while satisfying these conditions.</em></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<pre>
<strong>Input:</strong> <code>usageLimits</code> = [1,2,5]
<strong>Output:</strong> 3
<strong>Explanation:</strong> In this example, we can use 0 at most once, 1 at most twice, and 2 at most five times.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [2].
Group 2 contains the numbers [1,2].
Group 3 contains the numbers [0,1,2].
It can be shown that the maximum number of groups is 3.
So, the output is 3. </pre>
<p><strong class="example">Example 2:</strong></p>
<pre>
<strong>Input:</strong> <code>usageLimits</code> = [2,1,2]
<strong>Output:</strong> 2
<strong>Explanation:</strong> In this example, we can use 0 at most twice, 1 at most once, and 2 at most twice.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [0].
Group 2 contains the numbers [1,2].
It can be shown that the maximum number of groups is 2.
So, the output is 2.
</pre>
<p><strong class="example">Example 3:</strong></p>
<pre>
<strong>Input:</strong> <code>usageLimits</code> = [1,1]
<strong>Output:</strong> 1
<strong>Explanation:</strong> In this example, we can use both 0 and 1 at most once.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [0].
It can be shown that the maximum number of groups is 1.
So, the output is 1.
</pre>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= usageLimits.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= usageLimits[i] &lt;= 10<sup>9</sup></code></li>
</ul>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
{
"data": {
"question": {
"questionId": "2907",
"questionFrontendId": "2804",
"boundTopicId": null,
"title": "Array Prototype ForEach",
"titleSlug": "array-prototype-foreach",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 6,
"dislikes": 4,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "[1,2,3]\nfunction(val, i, arr){ arr[i] = val * 2 }\n{\"context\": true}\n[true, true, false, false]\nfunction(val, i, arr){ arr[i] = this }\n{\"context\": false}\n[true, true, false, false]\nfunction(val, i, arr){ arr[i] = !val }\n{\"context\": 5}",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"115\", \"totalSubmission\": \"123\", \"totalAcceptedRaw\": 115, \"totalSubmissionRaw\": 123, \"acRate\": \"93.5%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "[1,2,3]\nfunction(val, i, arr){ arr[i] = val * 2 }\n{\"context\": true}",
"metaData": "{\n \"name\": \"foobar\",\n \"params\": [\n {\n \"name\": \"arr\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"callback\"\n },\n {\n \"type\": \"string\",\n \"name\": \"context\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,43 @@
{
"data": {
"question": {
"questionId": "2861",
"questionFrontendId": "2794",
"boundTopicId": null,
"title": "Create Object from Two Arrays",
"titleSlug": "create-object-from-two-arrays",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 5,
"dislikes": 2,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "[\"a\",\"b\",\"c\"]\n[1,2,3]\n[1,\"1\",false]\n[4,5,6]\n[]\n[]",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"170\", \"totalSubmission\": \"259\", \"totalAcceptedRaw\": 170, \"totalSubmissionRaw\": 259, \"acRate\": \"65.6%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "[\"a\",\"b\",\"c\"]\n[1,2,3]",
"metaData": "{\n \"name\": \"createObject\",\n \"params\": [\n {\n \"name\": \"keysArr\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"valuesArr\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,43 @@
{
"data": {
"question": {
"questionId": "2908",
"questionFrontendId": "2805",
"boundTopicId": null,
"title": "Custom Interval",
"titleSlug": "custom-interval",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 6,
"dislikes": 4,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "50\n20\n225\n20\n20\n150\n100\n200\n500",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"75\", \"totalSubmission\": \"82\", \"totalAcceptedRaw\": 75, \"totalSubmissionRaw\": 82, \"acRate\": \"91.5%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "50\n20\n225",
"metaData": "{\n \"name\": \"foobar\",\n \"params\": [\n {\n \"type\": \"integer\",\n \"name\": \"delay\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"period\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"stopTime\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,43 @@
{
"data": {
"question": {
"questionId": "2901",
"questionFrontendId": "2803",
"boundTopicId": null,
"title": "Factorial Generator",
"titleSlug": "factorial-generator",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 9,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "5\n2\n0",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"136\", \"totalSubmission\": \"149\", \"totalAcceptedRaw\": 136, \"totalSubmissionRaw\": 149, \"acRate\": \"91.3%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "5",
"metaData": "{\n \"name\": \"factorial\",\n \"params\": [\n {\n \"name\": \"n\",\n \"type\": \"integer\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,65 @@
{
"data": {
"question": {
"questionId": "3002",
"questionFrontendId": "2783",
"boundTopicId": null,
"title": "Flight Occupancy and Waitlist Analysis",
"titleSlug": "flight-occupancy-and-waitlist-analysis",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 7,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1],[102,1],[103,1],[104,2],[105,2],[106,3],[107,3]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": null,
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"355\", \"totalSubmission\": \"852\", \"totalAcceptedRaw\": 355, \"totalSubmissionRaw\": 852, \"acRate\": \"41.7%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1],[102,1],[103,1],[104,2],[105,2],[106,3],[107,3]]}}",
"metaData": "{\"mysql\": [\"Create table if not exists Flights(flight_id int,capacity int)\", \"Create table if not exists Passengers (passenger_id int,flight_id int)\"], \"mssql\": [\"Create table Flights(flight_id int,capacity int)\", \"Create table Passengers (passenger_id int,flight_id int)\"], \"oraclesql\": [\"Create table Flights(flight_id int,capacity int)\", \"Create table Passengers (passenger_id int,flight_id int)\"], \"database\": true, \"name\": \"waitlist_analysis\", \"pythondata\": [\"Flights = pd.DataFrame([], columns=['flight_id', 'capacity']).astype({'flight_id':'Int64', 'capacity':'Int64'})\", \"Passengers = pd.DataFrame([], columns=['passenger_id', 'flight_id']).astype({'passenger_id':'Int64', 'flight_id':'Int64'})\"], \"database_schema\": {\"Flights\": {\"flight_id\": \"INT\", \"capacity\": \"INT\"}, \"Passengers\": {\"passenger_id\": \"INT\", \"flight_id\": \"INT\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if not exists Flights(flight_id int,capacity int)",
"Create table if not exists Passengers (passenger_id int,flight_id int)",
"Truncate table Flights",
"insert into Flights (flight_id, capacity) values ('1', '2')",
"insert into Flights (flight_id, capacity) values ('2', '2')",
"insert into Flights (flight_id, capacity) values ('3', '1')",
"Truncate table Passengers",
"insert into Passengers (passenger_id, flight_id) values ('101', '1')",
"insert into Passengers (passenger_id, flight_id) values ('102', '1')",
"insert into Passengers (passenger_id, flight_id) values ('103', '1')",
"insert into Passengers (passenger_id, flight_id) values ('104', '2')",
"insert into Passengers (passenger_id, flight_id) values ('105', '2')",
"insert into Passengers (passenger_id, flight_id) values ('106', '3')",
"insert into Passengers (passenger_id, flight_id) values ('107', '3')"
],
"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>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,50 @@
{
"data": {
"question": {
"questionId": "2898",
"questionFrontendId": "2795",
"boundTopicId": null,
"title": "Parallel Execution of Promises for Individual Results Retrieval",
"titleSlug": "parallel-execution-of-promises-for-individual-results-retrieval",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 5,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "[() => new Promise(resolve => setTimeout(() => resolve(15), 100))]\n[() => new Promise(resolve => setTimeout(() => resolve(20), 100)), () => new Promise(resolve => setTimeout(() => resolve(15), 100))]\n[() => new Promise(resolve => setTimeout(() => resolve(30), 200)), () => new Promise((resolve, reject) => setTimeout(() => reject(\"Error\"), 100))]",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"117\", \"totalSubmission\": \"127\", \"totalAcceptedRaw\": 117, \"totalSubmissionRaw\": 127, \"acRate\": \"92.1%\"}",
"hints": [],
"solution": {
"id": "2034",
"canSeeDetail": true,
"paidOnly": false,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
"status": null,
"sampleTestCase": "[() => new Promise(resolve => setTimeout(() => resolve(15), 100))]",
"metaData": "{\n \"name\": \"promiseAllSettled\",\n \"params\": [\n {\n \"name\": \"functions\",\n \"type\": \"string\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,43 @@
{
"data": {
"question": {
"questionId": "2900",
"questionFrontendId": "2797",
"boundTopicId": null,
"title": "Partial Function with Placeholders",
"titleSlug": "partial-function-with-placeholders",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 4,
"dislikes": 1,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "(...args) => args\n[2,4,6]\n[8,10]\n(...args) => args\n[1,2,\"_\",4,\"_\",6]\n[3,5]\n(a, b, c) => b + a - c\n[\"_\", 5]\n[5, 20]",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"125\", \"totalSubmission\": \"136\", \"totalAcceptedRaw\": 125, \"totalSubmissionRaw\": 136, \"acRate\": \"91.9%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "(...args) => args\n[2,4,6]\n[8,10]",
"metaData": "{\n \"name\": \"partial\",\n \"params\": [\n {\n \"name\": \"fn\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"args\"\n },\n {\n \"type\": \"string\",\n \"name\": \"restArgs\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,43 @@
{
"data": {
"question": {
"questionId": "2899",
"questionFrontendId": "2796",
"boundTopicId": null,
"title": "Repeat String",
"titleSlug": "repeat-string",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 8,
"dislikes": 2,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "\"hello\"\n2\n\"code\"\n3\n\"js\"\n1",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"286\", \"totalSubmission\": \"297\", \"totalAcceptedRaw\": 286, \"totalSubmissionRaw\": 297, \"acRate\": \"96.3%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "\"hello\"\n2",
"metaData": "{\n \"name\": \"repeat\",\n \"params\": [\n {\n \"name\": \"str\",\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"times\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ],\n \"manual\": true\n}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,58 @@
{
"data": {
"question": {
"questionId": "3003",
"questionFrontendId": "2793",
"boundTopicId": null,
"title": "Status of Flight Tickets",
"titleSlug": "status-of-flight-tickets",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 2,
"dislikes": 10,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\",\"booking_time\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1,\"2023-07-10 16:30:00\"],[102,1,\"2023-07-10 17:45:00\"],[103,1,\"2023-07-10 12:00:00\"],[104,2,\"2023-07-05 13:23:00\"],[105,2,\"2023-07-05 09:00:00\"],[106,3,\"2023-07-08 11:10:00\"],[107,3,\"2023-07-08 09:10:00\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"156\", \"totalSubmission\": \"325\", \"totalAcceptedRaw\": 156, \"totalSubmissionRaw\": 325, \"acRate\": \"48.0%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Flights\":[\"flight_id\",\"capacity\"],\"Passengers\":[\"passenger_id\",\"flight_id\",\"booking_time\"]},\"rows\":{\"Flights\":[[1,2],[2,2],[3,1]],\"Passengers\":[[101,1,\"2023-07-10 16:30:00\"],[102,1,\"2023-07-10 17:45:00\"],[103,1,\"2023-07-10 12:00:00\"],[104,2,\"2023-07-05 13:23:00\"],[105,2,\"2023-07-05 09:00:00\"],[106,3,\"2023-07-08 11:10:00\"],[107,3,\"2023-07-08 09:10:00\"]]}}",
"metaData": "{\"mysql\": [\"Create table if not exists Flights(flight_id int,capacity int)\", \"Create table if not exists Passengers (passenger_id int,flight_id int,booking_time datetime)\"], \"mssql\": [\"Create table Flights(flight_id int,capacity int)\", \"Create table Passengers (passenger_id int,flight_id int, booking_time datetime)\"], \"oraclesql\": [\"Create table Flights(flight_id int,capacity int)\", \"Create table Passengers (passenger_id int,flight_id int, booking_time date)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"languages\": [\"mysql\", \"mssql\", \"oraclesql\"], \"database_schema\": {\"Flights\": {\"flight_id\": \"INT\", \"capacity\": \"INT\"}, \"Passengers\": {\"passenger_id\": \"INT\", \"flight_id\": \"INT\", \"booking_time\": \"DATETIME\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if not exists Flights(flight_id int,capacity int)",
"Create table if not exists Passengers (passenger_id int,flight_id int,booking_time datetime)",
"Truncate table Flights",
"insert into Flights (flight_id, capacity) values ('1', '2')",
"insert into Flights (flight_id, capacity) values ('2', '2')",
"insert into Flights (flight_id, capacity) values ('3', '1')",
"Truncate table Passengers",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('101', '1', '2023-07-10 16:30:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('102', '1', '2023-07-10 17:45:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('103', '1', '2023-07-10 12:00:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('104', '2', '2023-07-05 13:23:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('105', '2', '2023-07-05 09:00:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('106', '3', '2023-07-08 11:10:00')",
"insert into Passengers (passenger_id, flight_id, booking_time) values ('107', '3', '2023-07-08 09:10:00')"
],
"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

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

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

Some files were not shown because too many files have changed in this diff Show More