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:
zhangbk1 2024-06-05 08:53:56 +08:00
parent 4b8628b444
commit f55b93a706
33 changed files with 10744 additions and 6357 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
{
"data": {
"question": {
"questionId": "3465",
"questionFrontendId": "3156",
"boundTopicId": null,
"title": "Employee Task Duration and Concurrent Tasks",
"titleSlug": "employee-task-duration-and-concurrent-tasks",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Hard",
"likes": 3,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"Tasks\":[\"task_id\",\"employee_id\",\"start_time\",\"end_time\"]},\"rows\":{\"Tasks\":[[1,1001,\"2023-05-01 08:00:00\",\"2023-05-01 09:00:00\"],[2,1001,\"2023-05-01 08:30:00\",\"2023-05-01 10:30:00\"],[3,1001,\"2023-05-01 11:00:00\",\"2023-05-01 12:00:00\"],[7,1001,\"2023-05-01 13:00:00\",\"2023-05-01 15:30:00\"],[4,1002,\"2023-05-01 09:00:00\",\"2023-05-01 10:00:00\"],[5,1002,\"2023-05-01 09:30:00\",\"2023-05-01 11:30:00\"],[6,1003,\"2023-05-01 14:00:00\",\"2023-05-01 16:00:00\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": null,
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"217\", \"totalSubmission\": \"337\", \"totalAcceptedRaw\": 217, \"totalSubmissionRaw\": 337, \"acRate\": \"64.4%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"Tasks\":[\"task_id\",\"employee_id\",\"start_time\",\"end_time\"]},\"rows\":{\"Tasks\":[[1,1001,\"2023-05-01 08:00:00\",\"2023-05-01 09:00:00\"],[2,1001,\"2023-05-01 08:30:00\",\"2023-05-01 10:30:00\"],[3,1001,\"2023-05-01 11:00:00\",\"2023-05-01 12:00:00\"],[7,1001,\"2023-05-01 13:00:00\",\"2023-05-01 15:30:00\"],[4,1002,\"2023-05-01 09:00:00\",\"2023-05-01 10:00:00\"],[5,1002,\"2023-05-01 09:30:00\",\"2023-05-01 11:30:00\"],[6,1003,\"2023-05-01 14:00:00\",\"2023-05-01 16:00:00\"]]}}",
"metaData": "{\"mysql\": [\"CREATE TABLE if Not exists Tasks (\\n task_id INT ,\\n employee_id INT,\\n start_time DATETIME,\\n end_time DATETIME\\n);\"], \"mssql\": [\"CREATE TABLE Tasks (\\n task_id INT PRIMARY KEY,\\n employee_id INT,\\n start_time DATETIME,\\n end_time DATETIME\\n);\\n\"], \"oraclesql\": [\"CREATE TABLE Tasks (\\n task_id int ,\\n employee_id int,\\n start_time DATE,\\n end_time DATE\\n)\\n\\n\\n\\n\\n\\n\\n\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"postgresql\": [\"CREATE TABLE IF NOT EXISTS Tasks (\\n task_id INT,\\n employee_id INT,\\n start_time TIMESTAMP,\\n end_time TIMESTAMP\\n);\\n\"], \"pythondata\": [\"Tasks = pd.DataFrame([], columns=['task_id', 'employee_id', 'start_time', 'end_time']).astype({\\n 'task_id': 'Int64',\\n 'employee_id': 'Int64',\\n 'start_time': 'datetime64[ns]',\\n 'end_time': 'datetime64[ns]'\\n})\"], \"database\": true, \"name\": \"find_total_duration\", \"database_schema\": {\"Tasks\": {\"task_id\": \"INT\", \"employee_id\": \"INT\", \"start_time\": \"DATETIME\", \"end_time\": \"DATETIME\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"CREATE TABLE if Not exists Tasks (\n task_id INT ,\n employee_id INT,\n start_time DATETIME,\n end_time DATETIME\n);",
"Truncate table Tasks",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('1', '1001', '2023-05-01 08:00:00', '2023-05-01 09:00:00')",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('2', '1001', '2023-05-01 08:30:00', '2023-05-01 10:30:00')",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('3', '1001', '2023-05-01 11:00:00', '2023-05-01 12:00:00')",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('7', '1001', '2023-05-01 13:00:00', '2023-05-01 15:30:00')",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('4', '1002', '2023-05-01 09:00:00', '2023-05-01 10:00:00')",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('5', '1002', '2023-05-01 09:30:00', '2023-05-01 11:30:00')",
"insert into Tasks (task_id, employee_id, start_time, end_time) values ('6', '1003', '2023-05-01 14:00:00', '2023-05-01 16:00: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>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,61 @@
{
"data": {
"question": {
"questionId": "3481",
"questionFrontendId": "3172",
"boundTopicId": null,
"title": "Second Day Verification",
"titleSlug": "second-day-verification",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Easy",
"likes": 2,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\":{\"emails\":[\"email_id\",\"user_id\",\"signup_date\"],\"texts\":[\"text_id\",\"email_id\",\"signup_action\",\"action_date\"]},\"rows\":{\"emails\":[[125,7771,\"2022-06-14 09:30:00\"],[433,1052,\"2022-07-09 08:15:00\"],[234,7005,\"2022-08-20 10:00:00\"]],\"texts\":[[1,125,\"Verified\",\"2022-06-15 08:30:00\"],[2,433,\"Not Verified\",\"2022-07-10 10:45:00\"],[4,234,\"Verified\",\"2022-08-21 09:30:00\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": null,
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"144\", \"totalSubmission\": \"169\", \"totalAcceptedRaw\": 144, \"totalSubmissionRaw\": 169, \"acRate\": \"85.2%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\":{\"emails\":[\"email_id\",\"user_id\",\"signup_date\"],\"texts\":[\"text_id\",\"email_id\",\"signup_action\",\"action_date\"]},\"rows\":{\"emails\":[[125,7771,\"2022-06-14 09:30:00\"],[433,1052,\"2022-07-09 08:15:00\"],[234,7005,\"2022-08-20 10:00:00\"]],\"texts\":[[1,125,\"Verified\",\"2022-06-15 08:30:00\"],[2,433,\"Not Verified\",\"2022-07-10 10:45:00\"],[4,234,\"Verified\",\"2022-08-21 09:30:00\"]]}}",
"metaData": "{\"mysql\": [\"CREATE TABLE If not exists emails (\\n email_id INT,\\n user_id INT,\\n signup_date DATETIME\\n);\", \"CREATE TABLE If not exists texts (\\n text_id INT,\\n email_id INT,\\n signup_action ENUM('Verified', 'Not Verified'),\\n action_date DATETIME\\n);\"], \"mssql\": [\"CREATE TABLE emails (\\n email_id INT,\\n user_id INT,\\n signup_date DATETIME\\n);\", \"CREATE TABLE texts (\\n text_id INT,\\n email_id INT,\\n signup_action VARCHAR(12),\\n action_date DATETIME\\n);\"], \"oraclesql\": [\"CREATE TABLE emails (\\n email_id NUMBER,\\n user_id NUMBER,\\n signup_date DATE\\n)\\n\", \"CREATE TABLE texts (\\n text_id NUMBER,\\n email_id NUMBER,\\n signup_action VARCHAR(32),\\n action_date DATE\\n)\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"name\": \"find_second_day_signups\", \"postgresql\": [\"CREATE TABLE emails (\\n email_id INTEGER,\\n user_id INTEGER,\\n signup_date DATE\\n);\\n\", \"CREATE TABLE texts (\\n text_id INTEGER,\\n email_id INTEGER,\\n signup_action VARCHAR(32),\\n action_date DATE\\n);\\n\", \"SELECT to_char(action_date, 'YYYY-MM-DD HH24:MI:SS') FROM texts;\\n\"], \"pythondata\": [\"emails = pd.DataFrame([], columns=['email_id', 'user_id', 'signup_date']).astype({\\n 'email_id': 'Int64', # Nullable integer type\\n 'user_id': 'Int64', # Nullable integer type\\n 'signup_date': 'datetime64[ns]' # DateTime type for signup date\\n})\", \"texts = pd.DataFrame([], columns=['text_id', 'email_id', 'signup_action', 'action_date']).astype({\\n 'text_id': 'Int64', # Nullable integer type for text_id\\n 'email_id': 'Int64', # Nullable integer type for email_id\\n 'signup_action': 'object', # Using 'object' to store string values for ENUM\\n 'action_date': 'datetime64[ns]' # DateTime type for action_date\\n})\"], \"database_schema\": {\"emails\": {\"email_id\": \"INT\", \"user_id\": \"INT\", \"signup_date\": \"DATETIME\"}, \"texts\": {\"text_id\": \"INT\", \"email_id\": \"INT\", \"signup_action\": \"ENUM('Verified', 'Not Verified')\", \"action_date\": \"DATETIME\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"CREATE TABLE If not exists emails (\n email_id INT,\n user_id INT,\n signup_date DATETIME\n);",
"CREATE TABLE If not exists texts (\n text_id INT,\n email_id INT,\n signup_action ENUM('Verified', 'Not Verified'),\n action_date DATETIME\n);",
"Truncate table emails",
"insert into emails (email_id, user_id, signup_date) values ('125', '7771', '2022-06-14 09:30:00')",
"insert into emails (email_id, user_id, signup_date) values ('433', '1052', '2022-07-09 08:15:00')",
"insert into emails (email_id, user_id, signup_date) values ('234', '7005', '2022-08-20 10:00:00')",
"Truncate table texts",
"insert into texts (text_id, email_id, signup_action, action_date) values ('1', '125', 'Verified', '2022-06-15 08:30:00')",
"insert into texts (text_id, email_id, signup_action, action_date) values ('2', '433', 'Not Verified', '2022-07-10 10:45:00')",
"insert into texts (text_id, email_id, signup_action, action_date) values ('4', '234', 'Verified', '2022-08-21 09:30: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>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

View File

@ -0,0 +1,169 @@
{
"data": {
"question": {
"questionId": "3440",
"questionFrontendId": "3126",
"boundTopicId": null,
"title": "Server Utilization Time",
"titleSlug": "server-utilization-time",
"content": null,
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": true,
"difficulty": "Medium",
"likes": 6,
"dislikes": 12,
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"headers\": {\"Servers\": [\"server_id\", \"status_time\", \"session_status\"]}, \"rows\": {\"Servers\": [[4, \"2023-11-29 20:22:50\", \"start\"], [4, \"2023-11-30 04:19:50\", \"stop\"], [2, \"2023-11-18 21:23:09\", \"start\"], [2, \"2023-11-19 00:38:09\", \"stop\"], [5, \"2023-11-27 18:38:16\", \"start\"], [5, \"2023-11-28 02:46:16\", \"stop\"], [4, \"2023-11-27 06:46:42\", \"start\"], [4, \"2023-11-27 08:23:42\", \"stop\"], [5, \"2023-11-11 05:09:45\", \"start\"], [5, \"2023-11-11 06:42:45\", \"stop\"], [5, \"2023-11-27 23:05:58\", \"start\"], [5, \"2023-11-27 23:48:58\", \"stop\"], [5, \"2023-11-14 16:29:34\", \"start\"], [5, \"2023-11-14 19:11:34\", \"stop\"], [1, \"2023-11-02 19:14:15\", \"start\"], [1, \"2023-11-02 20:19:15\", \"stop\"], [5, \"2023-11-03 06:55:30\", \"start\"], [5, \"2023-11-03 11:03:30\", \"stop\"], [4, \"2023-11-02 16:53:28\", \"start\"], [4, \"2023-11-02 22:28:28\", \"stop\"], [2, \"2023-11-20 07:06:41\", \"start\"], [2, \"2023-11-20 15:58:41\", \"stop\"], [1, \"2023-11-22 10:42:35\", \"start\"], [1, \"2023-11-22 19:14:35\", \"stop\"], [3, \"2023-11-23 03:05:39\", \"start\"], [3, \"2023-11-23 10:54:39\", \"stop\"], [3, \"2023-11-15 20:04:15\", \"start\"], [3, \"2023-11-15 21:30:15\", \"stop\"], [3, \"2023-11-12 08:21:42\", \"start\"], [3, \"2023-11-12 17:07:42\", \"stop\"], [1, \"2023-11-02 02:33:24\", \"start\"], [1, \"2023-11-02 12:10:24\", \"stop\"], [4, \"2023-11-14 03:55:29\", \"start\"], [4, \"2023-11-14 08:53:29\", \"stop\"], [2, \"2023-11-04 00:36:53\", \"start\"], [2, \"2023-11-04 00:37:53\", \"stop\"], [4, \"2023-11-08 01:54:18\", \"start\"], [4, \"2023-11-08 09:56:18\", \"stop\"], [1, \"2023-11-24 14:28:11\", \"start\"], [1, \"2023-11-24 21:38:11\", \"stop\"], [3, \"2023-11-20 22:55:03\", \"start\"], [3, \"2023-11-21 02:19:03\", \"stop\"], [3, \"2023-11-12 03:10:22\", \"start\"], [3, \"2023-11-12 08:29:22\", \"stop\"], [2, \"2023-11-02 14:55:46\", \"start\"], [2, \"2023-11-02 16:56:46\", \"stop\"], [1, \"2023-11-09 03:40:44\", \"start\"], [1, \"2023-11-09 03:52:44\", \"stop\"], [5, \"2023-11-16 17:43:28\", \"start\"], [5, \"2023-11-16 20:45:28\", \"stop\"], [2, \"2023-11-08 16:17:24\", \"start\"], [2, \"2023-11-09 00:59:24\", \"stop\"], [4, \"2023-11-25 04:46:06\", \"start\"], [4, \"2023-11-25 11:56:06\", \"stop\"], [2, \"2023-11-05 14:22:34\", \"start\"], [2, \"2023-11-05 21:33:34\", \"stop\"], [1, \"2023-11-02 09:49:22\", \"start\"], [1, \"2023-11-02 15:01:22\", \"stop\"], [5, \"2023-11-08 06:49:10\", \"start\"], [5, \"2023-11-08 13:33:10\", \"stop\"], [1, \"2023-11-22 21:00:23\", \"start\"], [1, \"2023-11-22 22:43:23\", \"stop\"], [3, \"2023-11-06 07:45:50\", \"start\"], [3, \"2023-11-06 15:18:50\", \"stop\"], [3, \"2023-11-02 22:13:17\", \"start\"], [3, \"2023-11-03 03:50:17\", \"stop\"], [1, \"2023-11-14 02:40:20\", \"start\"], [1, \"2023-11-14 03:57:20\", \"stop\"], [1, \"2023-11-08 21:13:00\", \"start\"], [1, \"2023-11-09 01:22:00\", \"stop\"], [5, \"2023-11-21 13:25:22\", \"start\"], [5, \"2023-11-21 19:46:22\", \"stop\"], [5, \"2023-11-16 04:37:55\", \"start\"], [5, \"2023-11-16 12:53:55\", \"stop\"], [2, \"2023-11-06 14:03:26\", \"start\"], [2, \"2023-11-06 17:11:26\", \"stop\"], [2, \"2023-11-11 08:18:54\", \"start\"], [2, \"2023-11-11 12:34:54\", \"stop\"], [2, \"2023-11-07 22:54:01\", \"start\"], [2, \"2023-11-08 08:22:01\", \"stop\"], [5, \"2023-11-23 14:08:03\", \"start\"], [5, \"2023-11-23 22:23:03\", \"stop\"], [1, \"2023-11-04 15:20:41\", \"start\"], [1, \"2023-11-04 16:09:41\", \"stop\"], [3, \"2023-11-05 01:24:32\", \"start\"], [3, \"2023-11-05 10:09:32\", \"stop\"], [4, \"2023-11-09 14:15:29\", \"start\"], [4, \"2023-11-09 18:39:29\", \"stop\"], [3, \"2023-11-28 21:43:00\", \"start\"], [3, \"2023-11-29 06:06:00\", \"stop\"], [2, \"2023-11-18 06:23:14\", \"start\"], [2, \"2023-11-18 07:34:14\", \"stop\"], [5, \"2023-11-09 17:27:02\", \"start\"], [5, \"2023-11-10 03:00:02\", \"stop\"], [2, \"2023-11-21 02:41:57\", \"start\"], [2, \"2023-11-21 07:28:57\", \"stop\"], [3, \"2023-11-08 00:36:12\", \"start\"], [3, \"2023-11-08 01:47:12\", \"stop\"], [1, \"2023-11-15 16:13:39\", \"start\"], [1, \"2023-11-15 20:29:39\", \"stop\"], [3, \"2023-11-03 06:25:01\", \"start\"], [3, \"2023-11-03 11:14:01\", \"stop\"], [1, \"2023-11-18 20:49:55\", \"start\"], [1, \"2023-11-18 23:04:55\", \"stop\"], [3, \"2023-11-13 05:02:21\", \"start\"], [3, \"2023-11-13 12:44:21\", \"stop\"], [2, \"2023-11-23 19:00:11\", \"start\"], [2, \"2023-11-24 04:59:11\", \"stop\"], [4, \"2023-11-20 01:16:38\", \"start\"], [4, \"2023-11-20 01:35:38\", \"stop\"], [1, \"2023-11-13 11:21:08\", \"start\"], [1, \"2023-11-13 11:56:08\", \"stop\"], [4, \"2023-11-21 23:09:45\", \"start\"], [4, \"2023-11-22 00:26:45\", \"stop\"], [2, \"2023-11-04 11:19:31\", \"start\"], [2, \"2023-11-04 16:46:31\", \"stop\"]]}}",
"categoryTitle": "Database",
"contributors": [],
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": null,
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": null,
"stats": "{\"totalAccepted\": \"522\", \"totalSubmission\": \"1.1K\", \"totalAcceptedRaw\": 522, \"totalSubmissionRaw\": 1090, \"acRate\": \"47.9%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\": {\"Servers\": [\"server_id\", \"status_time\", \"session_status\"]}, \"rows\": {\"Servers\": [[4, \"2023-11-29 20:22:50\", \"start\"], [4, \"2023-11-30 04:19:50\", \"stop\"], [2, \"2023-11-18 21:23:09\", \"start\"], [2, \"2023-11-19 00:38:09\", \"stop\"], [5, \"2023-11-27 18:38:16\", \"start\"], [5, \"2023-11-28 02:46:16\", \"stop\"], [4, \"2023-11-27 06:46:42\", \"start\"], [4, \"2023-11-27 08:23:42\", \"stop\"], [5, \"2023-11-11 05:09:45\", \"start\"], [5, \"2023-11-11 06:42:45\", \"stop\"], [5, \"2023-11-27 23:05:58\", \"start\"], [5, \"2023-11-27 23:48:58\", \"stop\"], [5, \"2023-11-14 16:29:34\", \"start\"], [5, \"2023-11-14 19:11:34\", \"stop\"], [1, \"2023-11-02 19:14:15\", \"start\"], [1, \"2023-11-02 20:19:15\", \"stop\"], [5, \"2023-11-03 06:55:30\", \"start\"], [5, \"2023-11-03 11:03:30\", \"stop\"], [4, \"2023-11-02 16:53:28\", \"start\"], [4, \"2023-11-02 22:28:28\", \"stop\"], [2, \"2023-11-20 07:06:41\", \"start\"], [2, \"2023-11-20 15:58:41\", \"stop\"], [1, \"2023-11-22 10:42:35\", \"start\"], [1, \"2023-11-22 19:14:35\", \"stop\"], [3, \"2023-11-23 03:05:39\", \"start\"], [3, \"2023-11-23 10:54:39\", \"stop\"], [3, \"2023-11-15 20:04:15\", \"start\"], [3, \"2023-11-15 21:30:15\", \"stop\"], [3, \"2023-11-12 08:21:42\", \"start\"], [3, \"2023-11-12 17:07:42\", \"stop\"], [1, \"2023-11-02 02:33:24\", \"start\"], [1, \"2023-11-02 12:10:24\", \"stop\"], [4, \"2023-11-14 03:55:29\", \"start\"], [4, \"2023-11-14 08:53:29\", \"stop\"], [2, \"2023-11-04 00:36:53\", \"start\"], [2, \"2023-11-04 00:37:53\", \"stop\"], [4, \"2023-11-08 01:54:18\", \"start\"], [4, \"2023-11-08 09:56:18\", \"stop\"], [1, \"2023-11-24 14:28:11\", \"start\"], [1, \"2023-11-24 21:38:11\", \"stop\"], [3, \"2023-11-20 22:55:03\", \"start\"], [3, \"2023-11-21 02:19:03\", \"stop\"], [3, \"2023-11-12 03:10:22\", \"start\"], [3, \"2023-11-12 08:29:22\", \"stop\"], [2, \"2023-11-02 14:55:46\", \"start\"], [2, \"2023-11-02 16:56:46\", \"stop\"], [1, \"2023-11-09 03:40:44\", \"start\"], [1, \"2023-11-09 03:52:44\", \"stop\"], [5, \"2023-11-16 17:43:28\", \"start\"], [5, \"2023-11-16 20:45:28\", \"stop\"], [2, \"2023-11-08 16:17:24\", \"start\"], [2, \"2023-11-09 00:59:24\", \"stop\"], [4, \"2023-11-25 04:46:06\", \"start\"], [4, \"2023-11-25 11:56:06\", \"stop\"], [2, \"2023-11-05 14:22:34\", \"start\"], [2, \"2023-11-05 21:33:34\", \"stop\"], [1, \"2023-11-02 09:49:22\", \"start\"], [1, \"2023-11-02 15:01:22\", \"stop\"], [5, \"2023-11-08 06:49:10\", \"start\"], [5, \"2023-11-08 13:33:10\", \"stop\"], [1, \"2023-11-22 21:00:23\", \"start\"], [1, \"2023-11-22 22:43:23\", \"stop\"], [3, \"2023-11-06 07:45:50\", \"start\"], [3, \"2023-11-06 15:18:50\", \"stop\"], [3, \"2023-11-02 22:13:17\", \"start\"], [3, \"2023-11-03 03:50:17\", \"stop\"], [1, \"2023-11-14 02:40:20\", \"start\"], [1, \"2023-11-14 03:57:20\", \"stop\"], [1, \"2023-11-08 21:13:00\", \"start\"], [1, \"2023-11-09 01:22:00\", \"stop\"], [5, \"2023-11-21 13:25:22\", \"start\"], [5, \"2023-11-21 19:46:22\", \"stop\"], [5, \"2023-11-16 04:37:55\", \"start\"], [5, \"2023-11-16 12:53:55\", \"stop\"], [2, \"2023-11-06 14:03:26\", \"start\"], [2, \"2023-11-06 17:11:26\", \"stop\"], [2, \"2023-11-11 08:18:54\", \"start\"], [2, \"2023-11-11 12:34:54\", \"stop\"], [2, \"2023-11-07 22:54:01\", \"start\"], [2, \"2023-11-08 08:22:01\", \"stop\"], [5, \"2023-11-23 14:08:03\", \"start\"], [5, \"2023-11-23 22:23:03\", \"stop\"], [1, \"2023-11-04 15:20:41\", \"start\"], [1, \"2023-11-04 16:09:41\", \"stop\"], [3, \"2023-11-05 01:24:32\", \"start\"], [3, \"2023-11-05 10:09:32\", \"stop\"], [4, \"2023-11-09 14:15:29\", \"start\"], [4, \"2023-11-09 18:39:29\", \"stop\"], [3, \"2023-11-28 21:43:00\", \"start\"], [3, \"2023-11-29 06:06:00\", \"stop\"], [2, \"2023-11-18 06:23:14\", \"start\"], [2, \"2023-11-18 07:34:14\", \"stop\"], [5, \"2023-11-09 17:27:02\", \"start\"], [5, \"2023-11-10 03:00:02\", \"stop\"], [2, \"2023-11-21 02:41:57\", \"start\"], [2, \"2023-11-21 07:28:57\", \"stop\"], [3, \"2023-11-08 00:36:12\", \"start\"], [3, \"2023-11-08 01:47:12\", \"stop\"], [1, \"2023-11-15 16:13:39\", \"start\"], [1, \"2023-11-15 20:29:39\", \"stop\"], [3, \"2023-11-03 06:25:01\", \"start\"], [3, \"2023-11-03 11:14:01\", \"stop\"], [1, \"2023-11-18 20:49:55\", \"start\"], [1, \"2023-11-18 23:04:55\", \"stop\"], [3, \"2023-11-13 05:02:21\", \"start\"], [3, \"2023-11-13 12:44:21\", \"stop\"], [2, \"2023-11-23 19:00:11\", \"start\"], [2, \"2023-11-24 04:59:11\", \"stop\"], [4, \"2023-11-20 01:16:38\", \"start\"], [4, \"2023-11-20 01:35:38\", \"stop\"], [1, \"2023-11-13 11:21:08\", \"start\"], [1, \"2023-11-13 11:56:08\", \"stop\"], [4, \"2023-11-21 23:09:45\", \"start\"], [4, \"2023-11-22 00:26:45\", \"stop\"], [2, \"2023-11-04 11:19:31\", \"start\"], [2, \"2023-11-04 16:46:31\", \"stop\"]]}}",
"metaData": "{\"mysql\": [\"Create table if not exists Servers ( server_id int, status_time timestamp, session_status ENUM ('start','stop'))\"], \"mssql\": [\"Create table Servers (server_id int, status_time datetime, session_status varchar(20) NOT NULL CHECK (session_status in ('start','stop')))\"], \"oraclesql\": [\"Create table Servers (server_id int, status_time date, session_status varchar(20) NOT NULL CHECK (session_status in ('start','stop')))\", \"ALTER SESSION SET nls_date_format='YYYY-MM-DD HH24:MI:SS'\"], \"database\": true, \"name\": \"server_utilization_time\", \"postgresql\": [\"Create table Servers (server_id int, status_time timestamp, session_status varchar(20) NOT NULL CHECK (session_status in ('start','stop')))\"], \"pythondata\": [\"Servers = pd.DataFrame(columns=['server_id', 'status_time', 'session_status'], dtype={'server_id': 'int', 'status_time': 'datetime64[ns]', 'session_status': pd.CategoricalDtype(categories=['start', 'stop'])})\\n\"], \"database_schema\": {\"Servers\": {\"server_id\": \"INT\", \"status_time\": \"TIMESTAMP\", \"session_status\": \"ENUM('start', 'stop')\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table if not exists Servers ( server_id int, status_time timestamp, session_status ENUM ('start','stop'))",
"Truncate table Servers",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-29 20:22:50', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-30 04:19:50', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-18 21:23:09', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-19 00:38:09', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-27 18:38:16', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-28 02:46:16', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-27 06:46:42', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-27 08:23:42', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-11 05:09:45', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-11 06:42:45', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-27 23:05:58', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-27 23:48:58', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-14 16:29:34', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-14 19:11:34', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-02 19:14:15', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-02 20:19:15', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-03 06:55:30', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-03 11:03:30', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-02 16:53:28', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-02 22:28:28', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-20 07:06:41', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-20 15:58:41', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-22 10:42:35', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-22 19:14:35', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-23 03:05:39', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-23 10:54:39', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-15 20:04:15', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-15 21:30:15', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-12 08:21:42', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-12 17:07:42', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-02 02:33:24', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-02 12:10:24', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-14 03:55:29', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-14 08:53:29', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-04 00:36:53', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-04 00:37:53', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-08 01:54:18', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-08 09:56:18', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-24 14:28:11', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-24 21:38:11', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-20 22:55:03', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-21 02:19:03', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-12 03:10:22', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-12 08:29:22', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-02 14:55:46', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-02 16:56:46', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-09 03:40:44', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-09 03:52:44', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-16 17:43:28', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-16 20:45:28', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-08 16:17:24', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-09 00:59:24', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-25 04:46:06', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-25 11:56:06', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-05 14:22:34', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-05 21:33:34', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-02 09:49:22', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-02 15:01:22', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-08 06:49:10', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-08 13:33:10', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-22 21:00:23', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-22 22:43:23', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-06 07:45:50', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-06 15:18:50', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-02 22:13:17', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-03 03:50:17', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-14 02:40:20', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-14 03:57:20', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-08 21:13:00', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-09 01:22:00', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-21 13:25:22', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-21 19:46:22', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-16 04:37:55', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-16 12:53:55', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-06 14:03:26', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-06 17:11:26', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-11 08:18:54', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-11 12:34:54', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-07 22:54:01', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-08 08:22:01', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-23 14:08:03', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-23 22:23:03', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-04 15:20:41', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-04 16:09:41', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-05 01:24:32', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-05 10:09:32', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-09 14:15:29', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-09 18:39:29', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-28 21:43:00', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-29 06:06:00', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-18 06:23:14', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-18 07:34:14', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-09 17:27:02', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('5', '2023-11-10 03:00:02', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-21 02:41:57', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-21 07:28:57', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-08 00:36:12', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-08 01:47:12', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-15 16:13:39', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-15 20:29:39', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-03 06:25:01', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-03 11:14:01', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-18 20:49:55', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-18 23:04:55', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-13 05:02:21', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('3', '2023-11-13 12:44:21', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-23 19:00:11', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-24 04:59:11', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-20 01:16:38', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-20 01:35:38', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-13 11:21:08', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('1', '2023-11-13 11:56:08', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-21 23:09:45', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('4', '2023-11-22 00:26:45', 'stop')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-04 11:19:31', 'start')",
"insert into Servers (server_id, status_time, session_status) values ('2', '2023-11-04 16:46:31', 'stop')"
],
"enableRunCode": true,
"enableTestMode": false,
"enableDebugger": false,
"envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"], \"pythondata\": [\"Pandas\", \"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0</p>\"], \"postgresql\": [\"PostgreSQL\", \"<p>PostgreSQL 16</p>\"]}",
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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,54 @@
<p>There exists an infinite number line, with its origin at 0 and extending towards the <strong>positive</strong> x-axis.</p>
<p>You are given a 2D array <code>queries</code>, which contains two types of queries:</p>
<ol>
<li>For a query of type 1, <code>queries[i] = [1, x]</code>. Build an obstacle at distance <code>x</code> from the origin. It is guaranteed that there is <strong>no</strong> obstacle at distance <code>x</code> when the query is asked.</li>
<li>For a query of type 2, <code>queries[i] = [2, x, sz]</code>. Check if it is possible to place a block of size <code>sz</code> <em>anywhere</em> in the range <code>[0, x]</code> on the line, such that the block <strong>entirely</strong> lies in the range <code>[0, x]</code>. A block <strong>cannot </strong>be placed if it intersects with any obstacle, but it may touch it. Note that you do<strong> not</strong> actually place the block. Queries are separate.</li>
</ol>
<p>Return a boolean array <code>results</code>, where <code>results[i]</code> is <code>true</code> if you can place the block specified in the <code>i<sup>th</sup></code> query of type 2, and <code>false</code> otherwise.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">queries = [[1,2],[2,3,3],[2,3,1],[2,2,2]]</span></p>
<p><strong>Output:</strong> <span class="example-io">[false,true,true]</span></p>
<p><strong>Explanation:</strong></p>
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2024/04/22/example0block.png" style="padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem; width: 309px; height: 129px;" /></strong></p>
<p>For query 0, place an obstacle at <code>x = 2</code>. A block of size at most 2 can be placed before <code>x = 3</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">queries = </span>[[1,7],[2,7,6],[1,2],[2,7,5],[2,7,6]]<!-- notionvc: 4a471445-5af1-4d72-b11b-94d351a2c8e9 --></p>
<p><strong>Output:</strong> [true,true,false]</p>
<p><strong>Explanation:</strong></p>
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2024/04/22/example1block.png" style="padding: 10px; background: rgb(255, 255, 255); border-radius: 0.5rem; width: 310px; height: 130px;" /></strong></p>
<ul>
<li>Place an obstacle at <code>x = 7</code> for query 0. A block of size at most 7 can be placed before <code>x = 7</code>.</li>
<li>Place an obstacle at <code>x = 2</code> for query 2. Now, a block of size at most 5 can be placed before <code>x = 7</code>, and a block of size at most 2 before <code>x = 2</code>.</li>
</ul>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= queries.length &lt;= 15 * 10<sup>4</sup></code></li>
<li><code>2 &lt;= queries[i].length &lt;= 3</code></li>
<li><code>1 &lt;= queries[i][0] &lt;= 2</code></li>
<li><code>1 &lt;= x, sz &lt;= min(5 * 10<sup>4</sup>, 3 * queries.length)</code></li>
<li>The input is generated such that for queries of type 1, no obstacle exists at distance <code>x</code> when the query is asked.</li>
<li>The input is generated such that there is at least one query of type 2.</li>
</ul>

View File

@ -0,0 +1,52 @@
<p>You are given a positive integer <code>days</code> representing the total number of days an employee is available for work (starting from day 1). You are also given a 2D array <code>meetings</code> of size <code>n</code> where, <code>meetings[i] = [start_i, end_i]</code> represents the starting and ending days of meeting <code>i</code> (inclusive).</p>
<p>Return the count of days when the employee is available for work but no meetings are scheduled.</p>
<p><strong>Note: </strong>The meetings may overlap.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">days = 10, meetings = [[5,7],[1,3],[9,10]]</span></p>
<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><strong>Explanation:</strong></p>
<p>There is no meeting scheduled on the 4<sup>th</sup> and 8<sup>th</sup> days.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">days = 5, meetings = [[2,4],[1,3]]</span></p>
<p><strong>Output:</strong> <span class="example-io">1</span></p>
<p><strong>Explanation:</strong></p>
<p>There is no meeting scheduled on the 5<sup>th </sup>day.</p>
</div>
<p><strong class="example">Example 3:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">days = 6, meetings = [[1,6]]</span></p>
<p><strong>Output:</strong> 0</p>
<p><strong>Explanation:</strong></p>
<p>Meetings are scheduled for all working days.</p>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= days &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= meetings.length &lt;= 10<sup>5</sup></code></li>
<li><code>meetings[i].length == 2</code></li>
<li><code><font face="monospace">1 &lt;= meetings[i][0] &lt;= meetings[i][1] &lt;= days</font></code></li>
</ul>

View File

@ -0,0 +1,51 @@
<p>You are given an array <code>nums</code> and an integer <code>k</code>. You need to find a <span data-keyword="subarray-nonempty">subarray</span> of <code>nums</code> such that the <strong>absolute difference</strong> between <code>k</code> and the bitwise <code>AND</code> of the subarray elements is as<strong> small</strong> as possible. In other words, select a subarray <code>nums[l..r]</code> such that <code>|k - (nums[l] AND nums[l + 1] ... AND nums[r])|</code> is minimum.</p>
<p>Return the <strong>minimum</strong> possible value of the absolute difference.</p>
<p>A <strong>subarray</strong> is a contiguous <b>non-empty</b> sequence of elements within an array.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [1,2,4,5], k = 3</span></p>
<p><strong>Output:</strong> <span class="example-io">1</span></p>
<p><strong>Explanation:</strong></p>
<p>The subarray <code>nums[2..3]</code> has <code>AND</code> value 4, which gives the minimum absolute difference <code>|3 - 4| = 1</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [1,2,1,2], k = 2</span></p>
<p><strong>Output:</strong> <span class="example-io">0</span></p>
<p><strong>Explanation:</strong></p>
<p>The subarray <code>nums[1..1]</code> has <code>AND</code> value 2, which gives the minimum absolute difference <code>|2 - 2| = 0</code>.</p>
</div>
<p><strong class="example">Example 3:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [1], k = 10</span></p>
<p><strong>Output:</strong> <span class="example-io">9</span></p>
<p><strong>Explanation:</strong></p>
<p>There is a single subarray with <code>AND</code> value 1, which gives the minimum absolute difference <code>|10 - 1| = 9</code>.</p>
</div>
<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>9</sup></code></li>
<li><code>1 &lt;= k &lt;= 10<sup>9</sup></code></li>
</ul>

View File

@ -0,0 +1,52 @@
<p>You are given an integer array <code>nums</code>. The <strong>uniqueness array</strong> of <code>nums</code> is the sorted array that contains the number of distinct elements of all the <span data-keyword="subarray-nonempty">subarrays</span> of <code>nums</code>. In other words, it is a sorted array consisting of <code>distinct(nums[i..j])</code>, for all <code>0 &lt;= i &lt;= j &lt; nums.length</code>.</p>
<p>Here, <code>distinct(nums[i..j])</code> denotes the number of distinct elements in the subarray that starts at index <code>i</code> and ends at index <code>j</code>.</p>
<p>Return the <strong>median</strong> of the <strong>uniqueness array</strong> of <code>nums</code>.</p>
<p><strong>Note</strong> that the <strong>median</strong> of an array is defined as the middle element of the array when it is sorted in non-decreasing order. If there are two choices for a median, the <strong>smaller</strong> of the two values is taken.<!-- notionvc: 7e0f5178-4273-4a82-95ce-3395297921dc --></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [1,2,3]</span></p>
<p><strong>Output:</strong> <span class="example-io">1</span></p>
<p><strong>Explanation:</strong></p>
<p>The uniqueness array of <code>nums</code> is <code>[distinct(nums[0..0]), distinct(nums[1..1]), distinct(nums[2..2]), distinct(nums[0..1]), distinct(nums[1..2]), distinct(nums[0..2])]</code> which is equal to <code>[1, 1, 1, 2, 2, 3]</code>. The uniqueness array has a median of 1. Therefore, the answer is 1.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [3,4,3,4,5]</span></p>
<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><strong>Explanation:</strong></p>
<p>The uniqueness array of <code>nums</code> is <code>[1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3]</code>. The uniqueness array has a median of 2. Therefore, the answer is 2.</p>
</div>
<p><strong class="example">Example 3:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [4,3,5,4]</span></p>
<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><strong>Explanation:</strong></p>
<p>The uniqueness array of <code>nums</code> is <code>[1, 1, 1, 1, 2, 2, 2, 3, 3, 3]</code>. The uniqueness array has a median of 2. Therefore, the answer is 2.</p>
</div>
<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>5</sup></code></li>
</ul>

View File

@ -0,0 +1,42 @@
<p>You are given an array <code>nums</code> which is a <span data-keyword="permutation">permutation</span> of <code>[0, 1, 2, ..., n - 1]</code>. The <strong>score</strong> of any permutation of <code>[0, 1, 2, ..., n - 1]</code> named <code>perm</code> is defined as:</p>
<p><code>score(perm) = |perm[0] - nums[perm[1]]| + |perm[1] - nums[perm[2]]| + ... + |perm[n - 1] - nums[perm[0]]|</code></p>
<p>Return the permutation <code>perm</code> which has the <strong>minimum</strong> possible score. If <em>multiple</em> permutations exist with this score, return the one that is <span data-keyword="lexicographically-smaller-array">lexicographically smallest</span> among them.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [1,0,2]</span></p>
<p><strong>Output:</strong> <span class="example-io">[0,1,2]</span></p>
<p><strong>Explanation:</strong></p>
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2024/04/04/example0gif.gif" style="width: 235px; height: 235px;" /></strong></p>
<p>The lexicographically smallest permutation with minimum cost is <code>[0,1,2]</code>. The cost of this permutation is <code>|0 - 0| + |1 - 2| + |2 - 1| = 2</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [0,2,1]</span></p>
<p><strong>Output:</strong> <span class="example-io">[0,2,1]</span></p>
<p><strong>Explanation:</strong></p>
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2024/04/04/example1gif.gif" style="width: 235px; height: 235px;" /></strong></p>
<p>The lexicographically smallest permutation with minimum cost is <code>[0,2,1]</code>. The cost of this permutation is <code>|0 - 1| + |2 - 2| + |1 - 0| = 2</code>.</p>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>2 &lt;= n == nums.length &lt;= 14</code></li>
<li><code>nums</code> is a permutation of <code>[0, 1, 2, ..., n - 1]</code>.</li>
</ul>

View File

@ -0,0 +1,58 @@
<p>You are given an integer <code>limit</code> and a 2D array <code>queries</code> of size <code>n x 2</code>.</p>
<p>There are <code>limit + 1</code> balls with <strong>distinct</strong> labels in the range <code>[0, limit]</code>. Initially, all balls are uncolored. For every query in <code>queries</code> that is of the form <code>[x, y]</code>, you mark ball <code>x</code> with the color <code>y</code>. After each query, you need to find the number of <strong>distinct</strong> colors among the balls.</p>
<p>Return an array <code>result</code> of length <code>n</code>, where <code>result[i]</code> denotes the number of distinct colors <em>after</em> <code>i<sup>th</sup></code> query.</p>
<p><strong>Note</strong> that when answering a query, lack of a color <em>will not</em> be considered as a color.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">limit = 4, queries = [[1,4],[2,5],[1,3],[3,4]]</span></p>
<p><strong>Output:</strong> <span class="example-io">[1,2,2,3]</span></p>
<p><strong>Explanation:</strong></p>
<p><img alt="" src="https://assets.leetcode.com/uploads/2024/04/17/ezgifcom-crop.gif" style="width: 455px; height: 145px;" /></p>
<ul>
<li>After query 0, ball 1 has color 4.</li>
<li>After query 1, ball 1 has color 4, and ball 2 has color 5.</li>
<li>After query 2, ball 1 has color 3, and ball 2 has color 5.</li>
<li>After query 3, ball 1 has color 3, ball 2 has color 5, and ball 3 has color 4.</li>
</ul>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">limit = 4, queries = [[0,1],[1,2],[2,2],[3,4],[4,5]]</span></p>
<p><strong>Output:</strong> <span class="example-io">[1,2,2,3,4]</span></p>
<p><strong>Explanation:</strong></p>
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2024/04/17/ezgifcom-crop2.gif" style="width: 457px; height: 144px;" /></strong></p>
<ul>
<li>After query 0, ball 0 has color 1.</li>
<li>After query 1, ball 0 has color 1, and ball 1 has color 2.</li>
<li>After query 2, ball 0 has color 1, and balls 1 and 2 have color 2.</li>
<li>After query 3, ball 0 has color 1, balls 1 and 2 have color 2, and ball 3 has color 4.</li>
<li>After query 4, ball 0 has color 1, balls 1 and 2 have color 2, ball 3 has color 4, and ball 4 has color 5.</li>
</ul>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= limit &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= n == queries.length &lt;= 10<sup>5</sup></code></li>
<li><code>queries[i].length == 2</code></li>
<li><code>0 &lt;= queries[i][0] &lt;= limit</code></li>
<li><code>1 &lt;= queries[i][1] &lt;= 10<sup>9</sup></code></li>
</ul>

View File

@ -0,0 +1,37 @@
<p>You are given 2 integer arrays <code>nums1</code> and <code>nums2</code> of lengths <code>n</code> and <code>m</code> respectively. You are also given a <strong>positive</strong> integer <code>k</code>.</p>
<p>A pair <code>(i, j)</code> is called <strong>good</strong> if <code>nums1[i]</code> is divisible by <code>nums2[j] * k</code> (<code>0 &lt;= i &lt;= n - 1</code>, <code>0 &lt;= j &lt;= m - 1</code>).</p>
<p>Return the total number of <strong>good</strong> pairs.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums1 = [1,3,4], nums2 = [1,3,4], k = 1</span></p>
<p><strong>Output:</strong> <span class="example-io">5</span></p>
<p><strong>Explanation:</strong></p>
The 5 good pairs are <code>(0, 0)</code>, <code>(1, 0)</code>, <code>(1, 1)</code>, <code>(2, 0)</code>, and <code>(2, 2)</code>.</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums1 = [1,2,4,12], nums2 = [2,4], k = 3</span></p>
<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><strong>Explanation:</strong></p>
<p>The 2 good pairs are <code>(3, 0)</code> and <code>(3, 1)</code>.</p>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= n, m &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= nums1[i], nums2[j] &lt;= 10<sup>6</sup></code></li>
<li><code>1 &lt;= k &lt;= 10<sup>3</sup></code></li>
</ul>

View File

@ -0,0 +1,43 @@
<p>You are given a string <code>s</code>. It may contain any number of <code>&#39;*&#39;</code> characters. Your task is to remove all <code>&#39;*&#39;</code> characters.</p>
<p>While there is a <code>&#39;*&#39;</code>, do the following operation:</p>
<ul>
<li>Delete the leftmost <code>&#39;*&#39;</code> and the <strong>smallest</strong> non-<code>&#39;*&#39;</code> character to its <em>left</em>. If there are several smallest characters, you can delete any of them.</li>
</ul>
<p>Return the <span data-keyword="lexicographically-smaller-string">lexicographically smallest</span> resulting string after removing all <code>&#39;*&#39;</code> characters.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;aaba*&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;aab&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>We should delete one of the <code>&#39;a&#39;</code> characters with <code>&#39;*&#39;</code>. If we choose <code>s[3]</code>, <code>s</code> becomes the lexicographically smallest.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;abc&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;abc&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>There is no <code>&#39;*&#39;</code> in the string.<!-- notionvc: ff07e34f-b1d6-41fb-9f83-5d0ba3c1ecde --></p>
</div>
<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 lowercase English letters and <code>&#39;*&#39;</code>.</li>
<li>The input is generated such that it is possible to delete all <code>&#39;*&#39;</code> characters.</li>
</ul>

View File

@ -0,0 +1,84 @@
<p>You are given an integer array <code>nums</code> and two integers <code>cost1</code> and <code>cost2</code>. You are allowed to perform <strong>either</strong> of the following operations <strong>any</strong> number of times:</p>
<ul>
<li>Choose an index <code>i</code> from <code>nums</code> and <strong>increase</strong> <code>nums[i]</code> by <code>1</code> for a cost of <code>cost1</code>.</li>
<li>Choose two <strong>different</strong> indices <code>i</code>, <code>j</code>, from <code>nums</code> and <strong>increase</strong> <code>nums[i]</code> and <code>nums[j]</code> by <code>1</code> for a cost of <code>cost2</code>.</li>
</ul>
<p>Return the <strong>minimum</strong> <strong>cost</strong> required to make all elements in the array <strong>equal</strong><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>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [4,1], cost1 = 5, cost2 = 2</span></p>
<p><strong>Output:</strong> <span class="example-io">15</span></p>
<p><strong>Explanation: </strong></p>
<p>The following operations can be performed to make the values equal:</p>
<ul>
<li>Increase <code>nums[1]</code> by 1 for a cost of 5. <code>nums</code> becomes <code>[4,2]</code>.</li>
<li>Increase <code>nums[1]</code> by 1 for a cost of 5. <code>nums</code> becomes <code>[4,3]</code>.</li>
<li>Increase <code>nums[1]</code> by 1 for a cost of 5. <code>nums</code> becomes <code>[4,4]</code>.</li>
</ul>
<p>The total cost is 15.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [2,3,3,3,5], cost1 = 2, cost2 = 1</span></p>
<p><strong>Output:</strong> <span class="example-io">6</span></p>
<p><strong>Explanation: </strong></p>
<p>The following operations can be performed to make the values equal:</p>
<ul>
<li>Increase <code>nums[0]</code> and <code>nums[1]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[3,4,3,3,5]</code>.</li>
<li>Increase <code>nums[0]</code> and <code>nums[2]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[4,4,4,3,5]</code>.</li>
<li>Increase <code>nums[0]</code> and <code>nums[3]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[5,4,4,4,5]</code>.</li>
<li>Increase <code>nums[1]</code> and <code>nums[2]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[5,5,5,4,5]</code>.</li>
<li>Increase <code>nums[3]</code> by 1 for a cost of 2. <code>nums</code> becomes <code>[5,5,5,5,5]</code>.</li>
</ul>
<p>The total cost is 6.</p>
</div>
<p><strong class="example">Example 3:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [3,5,3], cost1 = 1, cost2 = 3</span></p>
<p><strong>Output:</strong> <span class="example-io">4</span></p>
<p><strong>Explanation:</strong></p>
<p>The following operations can be performed to make the values equal:</p>
<ul>
<li>Increase <code>nums[0]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[4,5,3]</code>.</li>
<li>Increase <code>nums[0]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[5,5,3]</code>.</li>
<li>Increase <code>nums[2]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[5,5,4]</code>.</li>
<li>Increase <code>nums[2]</code> by 1 for a cost of 1. <code>nums</code> becomes <code>[5,5,5]</code>.</li>
</ul>
<p>The total cost is 4.</p>
</div>
<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>
<li><code>1 &lt;= cost1 &lt;= 10<sup>6</sup></code></li>
<li><code>1 &lt;= cost2 &lt;= 10<sup>6</sup></code></li>
</ul>

View File

@ -0,0 +1,38 @@
<p>You are given a string <code>s</code>, which is known to be a concatenation of <strong>anagrams</strong> of some string <code>t</code>.</p>
<p>Return the <strong>minimum</strong> possible length of the string <code>t</code>.</p>
<p>An <strong>anagram</strong> is formed by rearranging the letters of a string. For example, &quot;aab&quot;, &quot;aba&quot;, and, &quot;baa&quot; are anagrams of &quot;aab&quot;.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;abba&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><strong>Explanation:</strong></p>
<p>One possible string <code>t</code> could be <code>&quot;ba&quot;</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;cdef&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">4</span></p>
<p><strong>Explanation:</strong></p>
<p>One possible string <code>t</code> could be <code>&quot;cdef&quot;</code>, notice that <code>t</code> can be equal to <code>s</code>.</p>
</div>
<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> consist only of lowercase English letters.</li>
</ul>

View File

@ -0,0 +1,38 @@
<p>Given a string <code>s</code>, you need to partition it into one or more <strong>balanced</strong> <span data-keyword="substring">substrings</span>. For example, if <code>s == &quot;ababcc&quot;</code> then <code>(&quot;abab&quot;, &quot;c&quot;, &quot;c&quot;)</code>, <code>(&quot;ab&quot;, &quot;abc&quot;, &quot;c&quot;)</code>, and <code>(&quot;ababcc&quot;)</code> are all valid partitions, but <code>(&quot;a&quot;, <strong>&quot;bab&quot;</strong>, &quot;cc&quot;)</code>, <code>(<strong>&quot;aba&quot;</strong>, &quot;bc&quot;, &quot;c&quot;)</code>, and <code>(&quot;ab&quot;, <strong>&quot;abcc&quot;</strong>)</code> are not. The unbalanced substrings are bolded.</p>
<p>Return the <strong>minimum</strong> number of substrings that you can partition <code>s</code> into.</p>
<p><strong>Note:</strong> A <strong>balanced</strong> string is a string where each character in the string occurs the same number of times.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;fabccddg&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">3</span></p>
<p><strong>Explanation:</strong></p>
<p>We can partition the string <code>s</code> into 3 substrings in one of the following ways: <code>(&quot;fab, &quot;ccdd&quot;, &quot;g&quot;)</code>, or <code>(&quot;fabc&quot;, &quot;cd&quot;, &quot;dg&quot;)</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s = &quot;abababaccddb&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">2</span></p>
<p><strong>Explanation:</strong></p>
<p>We can partition the string <code>s</code> into 2 substrings like so: <code>(&quot;abab&quot;, &quot;abaccddb&quot;)</code>.</p>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= s.length &lt;= 1000</code></li>
<li><code>s</code> consists only of English lowercase letters.</li>
</ul>

View File

@ -0,0 +1,44 @@
<p>An array is considered <strong>special</strong> if every pair of its adjacent elements contains two numbers with different parity.</p>
<p>You are given an array of integer <code>nums</code> and a 2D integer matrix <code>queries</code>, where for <code>queries[i] = [from<sub>i</sub>, to<sub>i</sub>]</code> your task is to check that <span data-keyword="subarray">subarray</span> <code>nums[from<sub>i</sub>..to<sub>i</sub>]</code> is <strong>special</strong> or not.</p>
<p>Return an array of booleans <code>answer</code> such that <code>answer[i]</code> is <code>true</code> if <code>nums[from<sub>i</sub>..to<sub>i</sub>]</code> is special.<!-- notionvc: e5d6f4e2-d20a-4fbd-9c7f-22fbe52ef730 --></p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [3,4,1,2,6], queries = [[0,4]]</span></p>
<p><strong>Output:</strong> <span class="example-io">[false]</span></p>
<p><strong>Explanation:</strong></p>
<p>The subarray is <code>[3,4,1,2,6]</code>. 2 and 6 are both even.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">nums = [4,3,1,6], queries = [[0,2],[2,3]]</span></p>
<p><strong>Output:</strong> <span class="example-io">[false,true]</span></p>
<p><strong>Explanation:</strong></p>
<ol>
<li>The subarray is <code>[4,3,1]</code>. 3 and 1 are both odd. So the answer to this query is <code>false</code>.</li>
<li>The subarray is <code>[1,6]</code>. There is only one pair: <code>(1,6)</code> and it contains numbers with different parity. So the answer to this query is <code>true</code>.</li>
</ol>
</div>
<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>5</sup></code></li>
<li><code>1 &lt;= queries.length &lt;= 10<sup>5</sup></code></li>
<li><code>queries[i].length == 2</code></li>
<li><code>0 &lt;= queries[i][0] &lt;= queries[i][1] &lt;= nums.length - 1</code></li>
</ul>

View File

@ -0,0 +1,54 @@
<p>Given a string <code>word</code>, compress it using the following algorithm:</p>
<ul>
<li>Begin with an empty string <code>comp</code>. While <code>word</code> is <strong>not</strong> empty, use the following operation:
<ul>
<li>Remove a maximum length prefix of <code>word</code> made of a <em>single character</em> <code>c</code> repeating <strong>at most</strong> 9 times.</li>
<li>Append the length of the prefix followed by <code>c</code> to <code>comp</code>.</li>
</ul>
</li>
</ul>
<p>Return the string <code>comp</code>.</p>
<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">word = &quot;abcde&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;1a1b1c1d1e&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>Initially, <code>comp = &quot;&quot;</code>. Apply the operation 5 times, choosing <code>&quot;a&quot;</code>, <code>&quot;b&quot;</code>, <code>&quot;c&quot;</code>, <code>&quot;d&quot;</code>, and <code>&quot;e&quot;</code> as the prefix in each operation.</p>
<p>For each prefix, append <code>&quot;1&quot;</code> followed by the character to <code>comp</code>.</p>
</div>
<p><strong class="example">Example 2:</strong></p>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">word = &quot;aaaaaaaaaaaaaabb&quot;</span></p>
<p><strong>Output:</strong> <span class="example-io">&quot;9a5a2b&quot;</span></p>
<p><strong>Explanation:</strong></p>
<p>Initially, <code>comp = &quot;&quot;</code>. Apply the operation 3 times, choosing <code>&quot;aaaaaaaaa&quot;</code>, <code>&quot;aaaaa&quot;</code>, and <code>&quot;bb&quot;</code> as the prefix in each operation.</p>
<ul>
<li>For prefix <code>&quot;aaaaaaaaa&quot;</code>, append <code>&quot;9&quot;</code> followed by <code>&quot;a&quot;</code> to <code>comp</code>.</li>
<li>For prefix <code>&quot;aaaaa&quot;</code>, append <code>&quot;5&quot;</code> followed by <code>&quot;a&quot;</code> to <code>comp</code>.</li>
<li>For prefix <code>&quot;bb&quot;</code>, append <code>&quot;2&quot;</code> followed by <code>&quot;b&quot;</code> to <code>comp</code>.</li>
</ul>
</div>
<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 &lt;= word.length &lt;= 2 * 10<sup>5</sup></code></li>
<li><code>word</code> consists only of lowercase English letters.</li>
</ul>