mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-03 22:42:52 +08:00
update
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2853",
|
||||
"questionFrontendId": "2701",
|
||||
"boundTopicId": null,
|
||||
"title": "Consecutive Transactions with Increasing Amounts",
|
||||
"titleSlug": "consecutive-transactions-with-increasing-amounts",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 7,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": null,
|
||||
"categoryTitle": "Database",
|
||||
"contributors": [],
|
||||
"topicTags": [
|
||||
{
|
||||
"name": "Database",
|
||||
"slug": "database",
|
||||
"translatedName": null,
|
||||
"__typename": "TopicTagNode"
|
||||
}
|
||||
],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"104\", \"totalSubmission\": \"560\", \"totalAcceptedRaw\": 104, \"totalSubmissionRaw\": 560, \"acRate\": \"18.6%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"headers\":{\"Transactions\":[\"transaction_id\",\"customer_id\",\"transaction_date\",\"amount\"]},\"rows\":{\"Transactions\":[[1,101,\"2023-05-01\",100],[2,101,\"2023-05-02\",150],[3,101,\"2023-05-03\",200],[4,102,\"2023-05-01\",50],[5,102,\"2023-05-03\",100],[6,102,\"2023-05-04\",200],[7,105,\"2023-05-01\",100],[8,105,\"2023-05-02\",150],[9,105,\"2023-05-03\",200],[10,105,\"2023-05-04\",300],[11,105,\"2023-05-12\",250],[12,105,\"2023-05-13\",260],[13,105,\"2023-05-14\",270]]}}",
|
||||
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Transactions (transaction_id int, customer_id int, transaction_date date, amount int)\"\n ],\n \"mssql\": [\n \"Create table Transactions (transaction_id int, customer_id int, transaction_date date, amount int)\"\n ],\n \"oraclesql\": [\n \"Create table Transactions (transaction_id int, customer_id int, transaction_date date, amount int)\",\n \"ALTER SESSION SET nls_date_format='YYYY-MM-DD'\"\n ],\n \"database\": true\n}",
|
||||
"judgerAvailable": true,
|
||||
"judgeType": "large",
|
||||
"mysqlSchemas": [
|
||||
"Create table If Not Exists Transactions (transaction_id int, customer_id int, transaction_date date, amount int)",
|
||||
"Truncate table Transactions",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('1', '101', '2023-05-01', '100')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('2', '101', '2023-05-02', '150')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('3', '101', '2023-05-03', '200')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('4', '102', '2023-05-01', '50')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('5', '102', '2023-05-03', '100')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('6', '102', '2023-05-04', '200')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('7', '105', '2023-05-01', '100')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('8', '105', '2023-05-02', '150')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('9', '105', '2023-05-03', '200')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('10', '105', '2023-05-04', '300')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('11', '105', '2023-05-12', '250')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('12', '105', '2023-05-13', '260')",
|
||||
"insert into Transactions (transaction_id, customer_id, transaction_date, amount) values ('13', '105', '2023-05-14', '270')"
|
||||
],
|
||||
"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
48
leetcode/originData/[no content]immutability-helper.json
Normal file
48
leetcode/originData/[no content]immutability-helper.json
Normal file
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2773",
|
||||
"questionFrontendId": "2691",
|
||||
"boundTopicId": null,
|
||||
"title": "Immutability Helper",
|
||||
"titleSlug": "immutability-helper",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Hard",
|
||||
"likes": 3,
|
||||
"dislikes": 3,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Infinite Method Object\", \"titleSlug\": \"infinite-method-object\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"Make Object Immutable\", \"titleSlug\": \"make-object-immutable\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
|
||||
"exampleTestcases": "{\"val\":10}\n[proxy => { proxy.val += 1; }, proxy => { proxy.val -= 1; }]\n{\"arr\":[1,2,3]}\n[proxy => { proxy.arr[0] = 5; proxy.newVal = proxy.arr[0] + proxy.arr[1]; }]\n{\"obj\":{\"val\":{\"x\":10,\"y\":20}}}\n[proxy => { let data = proxy.obj.val; let temp = data.x; data.x = data.y; data.y = temp; }]",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"69\", \"totalSubmission\": \"96\", \"totalAcceptedRaw\": 69, \"totalSubmissionRaw\": 96, \"acRate\": \"71.9%\"}",
|
||||
"hints": [
|
||||
"Javascript has the concept of Proxy. That concept is critical to this problem.",
|
||||
"You you need to keep track of which values in the JSON were overwritten with new values.",
|
||||
"Somehow, keep a tree structure that exists parallel to the original object. This will keep track of all the edits.",
|
||||
"When the mutator function is done. Return a clone with those mutations applied. It will be inefficient to clone the entire object so only clone the minimum number of nodes."
|
||||
],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"val\":10}\n[proxy => { proxy.val += 1; }, proxy => { proxy.val -= 1; }]",
|
||||
"metaData": "{\n \"name\": \"produce\",\n \"params\": [\n {\n \"name\": \"obj\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"mutator\"\n }\n ],\n \"return\": {\n \"type\": \"string\"\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
47
leetcode/originData/[no content]infinite-method-object.json
Normal file
47
leetcode/originData/[no content]infinite-method-object.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2772",
|
||||
"questionFrontendId": "2690",
|
||||
"boundTopicId": null,
|
||||
"title": "Infinite Method Object",
|
||||
"titleSlug": "infinite-method-object",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Easy",
|
||||
"likes": 11,
|
||||
"dislikes": 2,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Immutability Helper\", \"titleSlug\": \"immutability-helper\", \"difficulty\": \"Hard\", \"translatedTitle\": null}, {\"title\": \"Make Object Immutable\", \"titleSlug\": \"make-object-immutable\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
|
||||
"exampleTestcases": "\"abc123\"\n\".-qw73n|^2It\"",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"196\", \"totalSubmission\": \"198\", \"totalAcceptedRaw\": 196, \"totalSubmissionRaw\": 198, \"acRate\": \"99.0%\"}",
|
||||
"hints": [
|
||||
"Javascript has the concept of Proxy. That concept is critical to this problem.",
|
||||
"Override all \"get\" for the object. Return a function instead.",
|
||||
"That function should return the \"prop\", i.e. the method name."
|
||||
],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "\"abc123\"",
|
||||
"metaData": "{\n \"name\": \"createInfiniteObject\",\n \"params\": [\n {\n \"type\": \"string\",\n \"name\": \"method\"\n }\n ],\n \"return\": {\n \"type\": \"string\"\n },\n \"manual\": true,\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ]\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
47
leetcode/originData/[no content]make-object-immutable.json
Normal file
47
leetcode/originData/[no content]make-object-immutable.json
Normal file
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2776",
|
||||
"questionFrontendId": "2692",
|
||||
"boundTopicId": null,
|
||||
"title": "Make Object Immutable",
|
||||
"titleSlug": "make-object-immutable",
|
||||
"content": null,
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": true,
|
||||
"difficulty": "Medium",
|
||||
"likes": 7,
|
||||
"dislikes": 0,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"Infinite Method Object\", \"titleSlug\": \"infinite-method-object\", \"difficulty\": \"Easy\", \"translatedTitle\": null}, {\"title\": \"Immutability Helper\", \"titleSlug\": \"immutability-helper\", \"difficulty\": \"Hard\", \"translatedTitle\": null}]",
|
||||
"exampleTestcases": "{\"x\":5}\n(obj) => { obj.x = 5; return obj.x; }\n[1,2,3]\n(arr) => { arr[1] = {}; return arr[2]; }\n{\"arr\":[1,2,3]}\n(obj) => { obj.arr.push(4); return 42; }\n{\"x\":2,\"y\":2}\n(obj) => { return Object.keys(obj); }",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": null,
|
||||
"stats": "{\"totalAccepted\": \"91\", \"totalSubmission\": \"144\", \"totalAcceptedRaw\": 91, \"totalSubmissionRaw\": 144, \"acRate\": \"63.2%\"}",
|
||||
"hints": [
|
||||
"Javascript has the concept of Proxy. That concept is critical to this problem.",
|
||||
"Recursively use proxy so that the user of the object is only able to access a proxy object.",
|
||||
"Override how set works. It should throw the correct error instead of actually setting a value."
|
||||
],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "{\"x\":5}\n(obj) => { obj.x = 5; return obj.x; }",
|
||||
"metaData": "{\n \"name\": \"makeImmutable\",\n \"params\": [\n {\n \"name\": \"obj\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"fn\"\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 4.5.4, 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 ES2020 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
63
leetcode/originData/array-wrapper.json
Normal file
63
leetcode/originData/array-wrapper.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2805",
|
||||
"questionFrontendId": "2695",
|
||||
"boundTopicId": null,
|
||||
"title": "Array Wrapper",
|
||||
"titleSlug": "array-wrapper",
|
||||
"content": "<p>Create a class <code>ArrayWrapper</code> that accepts an array of integers in it's constructor. This class should have two features:</p>\n\n<ul>\n\t<li>When two instances of this class are added together with the <code>+</code> operator, the resulting value is the sum of all the elements in both arrays.</li>\n\t<li>When the <code>String()</code> function is called on the instance, it will return a comma separated string surrounded by brackets. For example, <code>[1,2,3]</code>.</li>\n</ul>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [[1,2],[3,4]], operation = "Add"\n<strong>Output:</strong> 10\n<strong>Explanation:</strong>\nconst obj1 = new ArrayWrapper([1,2]);\nconst obj2 = new ArrayWrapper([3,4]);\nobj1 + obj2; // 10\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [[23,98,42,70]], operation = "String"\n<strong>Output:</strong> "[23,98,42,70]"\n<strong>Explanation:</strong>\nconst obj = new ArrayWrapper([23,98,42,70]);\nString(obj); // "[23,98,42,70]"\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> nums = [[],[]], operation = "Add"\n<strong>Output:</strong> 0\n<strong>Explanation:</strong>\nconst obj1 = new ArrayWrapper([]);\nconst obj2 = new ArrayWrapper([]);\nobj1 + obj2; // 0\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>0 <= nums.length <= 1000</code></li>\n\t<li><code>0 <= nums[i] <= 1000</code></li>\n\t<li><code>Note: nums is the array passed to the constructor</code></li>\n</ul>\n",
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 79,
|
||||
"dislikes": 9,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "[[1,2],[3,4]]\n\"Add\"\n[[23,98,42,70]]\n\"String\"\n[[],[]]\n\"Add\"",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
"lang": "JavaScript",
|
||||
"langSlug": "javascript",
|
||||
"code": "/**\n * @param {number[]} nums\n */\nvar ArrayWrapper = function(nums) {\n \n};\n\nArrayWrapper.prototype.valueOf = function() {\n \n}\n\nArrayWrapper.prototype.toString = function() {\n \n}\n\n/**\n * const obj1 = new ArrayWrapper([1,2]);\n * const obj2 = new ArrayWrapper([3,4]);\n * obj1 + obj2; // 10\n * String(obj1); // \"[1,2]\"\n * String(obj2); // \"[3,4]\"\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "TypeScript",
|
||||
"langSlug": "typescript",
|
||||
"code": "class ArrayWrapper {\n\tconstructor(nums: number[]) {\n \n }\n\n\tvalueOf() {\n \n }\n\n\ttoString() {\n \n }\n};\n\n/**\n * const obj1 = new ArrayWrapper([1,2]);\n * const obj2 = new ArrayWrapper([3,4]);\n * obj1 + obj2; // 10\n * String(obj1); // \"[1,2]\"\n * String(obj2); // \"[3,4]\"\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.7K\", \"totalSubmission\": \"5.1K\", \"totalAcceptedRaw\": 4672, \"totalSubmissionRaw\": 5145, \"acRate\": \"90.8%\"}",
|
||||
"hints": [],
|
||||
"solution": {
|
||||
"id": "1926",
|
||||
"canSeeDetail": true,
|
||||
"paidOnly": false,
|
||||
"hasVideoSolution": false,
|
||||
"paidOnlyVideo": true,
|
||||
"__typename": "ArticleNode"
|
||||
},
|
||||
"status": null,
|
||||
"sampleTestCase": "[[1,2],[3,4]]\n\"Add\"",
|
||||
"metaData": "{\n \"name\": \"ArrayWrapper\",\n \"params\": [\n {\n \"name\": \"nums\",\n \"type\": \"integer[][]\"\n },\n {\n \"type\": \"string\",\n \"name\": \"operation\"\n }\n ],\n \"return\": {\n \"type\": \"string\"\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
173
leetcode/originData/buy-two-chocolates.json
Normal file
173
leetcode/originData/buy-two-chocolates.json
Normal file
File diff suppressed because one or more lines are too long
63
leetcode/originData/call-function-with-custom-context.json
Normal file
63
leetcode/originData/call-function-with-custom-context.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2790",
|
||||
"questionFrontendId": "2693",
|
||||
"boundTopicId": null,
|
||||
"title": "Call Function with Custom Context",
|
||||
"titleSlug": "call-function-with-custom-context",
|
||||
"content": "<p>Enhance all functions to have the <code>callPolyfill</code> method. The method accepts an object <code>obj</code> as it's first parameter and any number of additional arguments. The <code>obj</code> becomes the <code>this</code> context for the function. The additional arguments are passed to the function (that the <code>callPolyfill</code> method belongs on).</p>\n\n<p>For example if you had the function:</p>\n\n<pre>\nfunction tax(price, taxRate) {\n const totalCost = price * (1 + taxRate);\n console.log(`The cost of ${this.item} is ${totalCost}`);\n}\n</pre>\n\n<p>Calling this function like <code>tax(10, 0.1)</code> will log <code>"The cost of undefined is 11"</code>. This is because the <code>this</code> context was not defined.</p>\n\n<p>However, calling the function like <code>tax.callPolyfill({item: "salad"}, 10, 0.1)</code> will log <code>"The cost of salad is 11"</code>. The <code>this</code> context was appropriately set, and the function logged an appropriate output.</p>\n\n<p>Please solve this without using the built-in <code>Function.call</code> method.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong>\nfn = function add(b) {\n return this.a + b;\n}\nargs = [{"a": 5}, 7]\n<strong>Output:</strong> 12\n<strong>Explanation:</strong>\nfn.callPolyfill({"a": 5}, 7); // 12\ncallPolyfill sets the "this" context to {"a": 5}. 7 is passed as an argument.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nfn = function tax(price, taxRate) { \n return `The cost of the ${this.item} is ${price * taxRate}`; \n}\nargs = [{"item": "burger"}, 10, 1,1]\n<strong>Output:</strong> "The cost of the burger is 11"\n<strong>Explanation:</strong> callPolyfill sets the "this" context to {"item": "burger"}. 10 and 1.1 are passed as additional arguments.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul style=\"list-style-type:square;\">\n\t<li><code><font face=\"monospace\">typeof args[0] == 'object' and args[0] != null</font></code></li>\n\t<li><code>1 <= args.length <= 100</code></li>\n\t<li><code>2 <= JSON.stringify(args[0]).length <= 10<sup>5</sup></code></li>\n</ul>\n",
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 87,
|
||||
"dislikes": 9,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "function add(b) { return this.a + b; }\n[{\"a\":5},7]\nfunction tax(price, taxRate) { return `The cost of the ${this.item} is ${price * taxRate}`; }\n[{\"item\":\"burger\"},10,1.1]",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
"lang": "JavaScript",
|
||||
"langSlug": "javascript",
|
||||
"code": "/**\n * @param {Object} context\n * @param {any[]} args\n * @return {any}\n */\nFunction.prototype.callPolyfill = function(context, ...args) {\n\n}\n\n/**\n * function increment() { this.count++; return this.count; }\n * increment.callPolyfill({count: 1}); // 2\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "TypeScript",
|
||||
"langSlug": "typescript",
|
||||
"code": "declare global { \n interface Function {\n callPolyfill(context: Record<any, any>, ...args: any[]): any;\n\t}\n}\n\nFunction.prototype.callPolyfill = function(context, ...args): any {\n\n}\n\n/**\n * function increment() { this.count++; return this.count; }\n * increment.callPolyfill({count: 1}); // 2\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.7K\", \"totalSubmission\": \"5.4K\", \"totalAcceptedRaw\": 4676, \"totalSubmissionRaw\": 5396, \"acRate\": \"86.7%\"}",
|
||||
"hints": [],
|
||||
"solution": {
|
||||
"id": "1924",
|
||||
"canSeeDetail": true,
|
||||
"paidOnly": false,
|
||||
"hasVideoSolution": false,
|
||||
"paidOnlyVideo": true,
|
||||
"__typename": "ArticleNode"
|
||||
},
|
||||
"status": null,
|
||||
"sampleTestCase": "function add(b) { return this.a + b; }\n[{\"a\":5},7]",
|
||||
"metaData": "{\n \"name\": \"callPolyfill\",\n \"params\": [\n {\n \"type\": \"string\",\n \"name\": \"context\"\n },\n {\n \"type\": \"string\",\n \"name\": \"args\"\n }\n ],\n \"return\": {\n \"type\": \"string\"\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
56
leetcode/originData/compact-object.json
Normal file
56
leetcode/originData/compact-object.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2804",
|
||||
"questionFrontendId": "2705",
|
||||
"boundTopicId": null,
|
||||
"title": "Compact Object",
|
||||
"titleSlug": "compact-object",
|
||||
"content": "<p>Given an object or array <code>obj</code>, return a <strong>compact object</strong>. A <strong>compact object</strong> is the same as the original object, except with keys containing <strong>falsy</strong> values removed. This operation applies to the object and any nested objects. Arrays are considered objects where the indices are keys. A value is considered <strong>falsy</strong> when <code>Boolean(value)</code> returns <code>false</code>.</p>\n\n<p>You may assume the <code>obj</code> is the output of <code>JSON.parse</code>. In other words, it is valid JSON.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = [null, 0, false, 1]\n<strong>Output:</strong> [1]\n<strong>Explanation:</strong> All falsy values have been removed from the array.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = {"a": null, "b": [false, 1]}\n<strong>Output:</strong> {"b": [1]}\n<strong>Explanation:</strong> obj["a"] and obj["b"][0] had falsy values and were removed.</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = [null, 0, 5, [0], [false, 16]]\n<strong>Output:</strong> [5, [], [16]]\n<strong>Explanation:</strong> obj[0], obj[1], obj[3][0], and obj[4][0] were falsy and removed.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>obj is a valid JSON object</code></li>\n\t<li><code>2 <= JSON.stringify(obj).length <= 10<sup>6</sup></code></li>\n</ul>\n",
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 16,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "[null, 0, false, 1]\n{\"a\": null, \"b\": [false, 1]}\n[null, 0, 5, [0], [false, 16]]",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
"lang": "JavaScript",
|
||||
"langSlug": "javascript",
|
||||
"code": "/**\n * @param {Object} obj\n * @return {Object}\n */\nvar compactObject = function(obj) {\n \n};",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "TypeScript",
|
||||
"langSlug": "typescript",
|
||||
"code": "type Obj = Record<any, any>;\n\nfunction compactObject(obj: Obj): Obj {\n\n};",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"442\", \"totalSubmission\": \"603\", \"totalAcceptedRaw\": 442, \"totalSubmissionRaw\": 603, \"acRate\": \"73.3%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "[null, 0, false, 1]",
|
||||
"metaData": "{\n \"name\": \"compactObject\",\n \"params\": [\n {\n \"name\": \"obj\",\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 4.5.4, 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 ES2020 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
67
leetcode/originData/differences-between-two-objects.json
Normal file
67
leetcode/originData/differences-between-two-objects.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2774",
|
||||
"questionFrontendId": "2700",
|
||||
"boundTopicId": null,
|
||||
"title": "Differences Between Two Objects",
|
||||
"titleSlug": "differences-between-two-objects",
|
||||
"content": "<p>Write a function that accepts two deeply nested objects or arrays <code>obj1</code> and <code>obj2</code> and returns a new object representing their differences.</p>\n\n<p>The function should compare the properties of the two objects and identify any changes. The returned object should only contains keys where the value is different from <code>obj1</code> to <code>obj2</code>. For each changed key, the value should be represented as an array <code>[obj1 value, obj2 value]</code>. Keys that exist in one object but not in the other should not be included in the returned object. When comparing two arrays, the indices of the arrays are considered to be their keys. The end result should be a deeply nested object where each leaf value is a difference array.</p>\n\n<p>You may assume that both objects are the output of <code>JSON.parse</code>.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nobj1 = {}\nobj2 = {\n "a": 1, \n "b": 2\n}\n<strong>Output:</strong> {}\n<strong>Explanation:</strong> There were no modifications made to obj1. New keys "a" and "b" appear in obj2, but keys that are added or removed should be ignored.\n</pre>\n\n<p><strong>Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nobj1 = {\n "a": 1,\n "v": 3,\n "x": [],\n "z": {\n "a": null\n }\n}\nobj2 = {\n "a": 2,\n "v": 4,\n "x": [],\n "z": {\n "a": 2\n }\n}\n<strong>Output:</strong> \n{\n "a": [1, 2],\n "v": [3, 4],\n "z": {\n "a": [null, 2]\n }\n}\n<strong>Explanation:</strong> The keys "a", "v", and "z" all had changes applied. "a" was chnaged from 1 to 2. "v" was changed from 3 to 4. "z" had a change applied to a child object. "z.a" was changed from null to 2.\n</pre>\n\n<p><strong>Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nobj1 = {\n "a": 5, \n "v": 6, \n "z": [1, 2, 4, [2, 5, 7]]\n}\nobj2 = {\n "a": 5, \n "v": 7, \n "z": [1, 2, 3, [1]]\n}\n<strong>Output:</strong> \n{\n "v": [6, 7],\n "z": {\n "2": [4, 3],\n "3": {\n "0": [2, 1]\n }\n }\n}\n<strong>Explanation:</strong> In obj1 and obj2, the keys "v" and "z" have different assigned values. "a" is ignored because the value is unchanged. In the key "z", there is a nested array. Arrays are treated like objects where the indices are keys. There were two alterations to the the array: z[2] and z[3][0]. z[0] and z[1] were unchanged and thus not included. z[3][1] and z[3][2] were removed and thus not included.\n</pre>\n\n<p><strong>Example 4:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nobj1 = {\n "a": {"b": 1}, \n}\nobj2 = {\n "a": [5],\n}\n<strong>Output:</strong> \n{\n "a": [{"b": 1}, [5]]\n}\n<strong>Explanation:</strong> The key "a" exists in both objects. Since the two associated values have different types, they are placed in the difference array.</pre>\n\n<p><strong>Example 5:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nobj1 = {\n "a": [1, 2, {}], \n "b": false\n}\nobj2 = { \n "b": false,\n "a": [1, 2, {}]\n}\n<strong>Output:</strong> \n{}\n<strong>Explanation:</strong> Apart from a different ordering of keys, the two objects are identical so an empty object is returned.</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>2 <= JSON.stringify(obj1).length <= 10<sup>4</sup></code></li>\n\t<li><code>2 <= JSON.stringify(obj2).length <= 10<sup>4</sup></code></li>\n</ul>\n",
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Medium",
|
||||
"likes": 110,
|
||||
"dislikes": 17,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[{\"title\": \"JSON Deep Equal\", \"titleSlug\": \"json-deep-equal\", \"difficulty\": \"Medium\", \"translatedTitle\": null}, {\"title\": \"Convert Object to JSON String\", \"titleSlug\": \"convert-object-to-json-string\", \"difficulty\": \"Medium\", \"translatedTitle\": null}]",
|
||||
"exampleTestcases": "{}\n{\"a\": 1, \"b\": 2}\n{\"a\": 1, \"v\": 3, \"x\": [], \"z\": {\"a\": null}}\n{\"a\": 2, \"v\": 4, \"x\": [], \"z\": {\"a\": 2}}\n{\"a\": 5, \"v\": 6, \"z\": [1,2,4, [2,5,7]]}\n{\"a\": 5, \"v\": 7, \"z\": [1,2,3, [1]]}\n{\"a\":{\"b\":1}}\n{\"a\":[5]}\n{\"a\": [1, 2, {}],\"b\": false}\n{\"b\": false, \"a\": [1, 2, {}]}",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
"lang": "JavaScript",
|
||||
"langSlug": "javascript",
|
||||
"code": "/**\n * @param {object} obj1\n * @param {object} obj2\n * @return {object}\n */\nfunction objDiff(obj1, obj2) {\n \n};",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "TypeScript",
|
||||
"langSlug": "typescript",
|
||||
"code": "function objDiff(obj1: any, obj2: any): any {\n\n};",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"4.6K\", \"totalSubmission\": \"5.5K\", \"totalAcceptedRaw\": 4567, \"totalSubmissionRaw\": 5469, \"acRate\": \"83.5%\"}",
|
||||
"hints": [
|
||||
"Find the intersection of the keys/indices on the two arrays/objects.",
|
||||
"Analyze the data structure recursively.",
|
||||
"For each key in the intersection, omit if there are no differences in the leaves. Otherwise return the difference."
|
||||
],
|
||||
"solution": {
|
||||
"id": "1914",
|
||||
"canSeeDetail": true,
|
||||
"paidOnly": false,
|
||||
"hasVideoSolution": false,
|
||||
"paidOnlyVideo": true,
|
||||
"__typename": "ArticleNode"
|
||||
},
|
||||
"status": null,
|
||||
"sampleTestCase": "{}\n{\"a\": 1, \"b\": 2}",
|
||||
"metaData": "{\n \"name\": \"objDiff\",\n \"params\": [\n {\n \"name\": \"obj1\",\n \"type\": \"string\"\n },\n {\n \"type\": \"string\",\n \"name\": \"obj2\"\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
63
leetcode/originData/event-emitter.json
Normal file
63
leetcode/originData/event-emitter.json
Normal file
File diff suppressed because one or more lines are too long
192
leetcode/originData/extra-characters-in-a-string.json
Normal file
192
leetcode/originData/extra-characters-in-a-string.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
188
leetcode/originData/greatest-common-divisor-traversal.json
Normal file
188
leetcode/originData/greatest-common-divisor-traversal.json
Normal file
File diff suppressed because one or more lines are too long
174
leetcode/originData/lexicographically-smallest-palindrome.json
Normal file
174
leetcode/originData/lexicographically-smallest-palindrome.json
Normal file
File diff suppressed because one or more lines are too long
187
leetcode/originData/maximum-strength-of-a-group.json
Normal file
187
leetcode/originData/maximum-strength-of-a-group.json
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
183
leetcode/originData/modify-graph-edge-weights.json
Normal file
183
leetcode/originData/modify-graph-edge-weights.json
Normal file
File diff suppressed because one or more lines are too long
167
leetcode/originData/remove-trailing-zeros-from-a-string.json
Normal file
167
leetcode/originData/remove-trailing-zeros-from-a-string.json
Normal file
File diff suppressed because one or more lines are too long
56
leetcode/originData/return-length-of-arguments-passed.json
Normal file
56
leetcode/originData/return-length-of-arguments-passed.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2820",
|
||||
"questionFrontendId": "2703",
|
||||
"boundTopicId": null,
|
||||
"title": "Return Length of Arguments Passed",
|
||||
"titleSlug": "return-length-of-arguments-passed",
|
||||
"content": "Write a function <code>argumentsLength</code> that returns the count of arguments passed to it.\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> argsArr = [5]\n<strong>Output:</strong> 1\n<strong>Explanation:</strong>\nargumentsLength(5); // 1\n\nOne value was passed to the function so it should return 1.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> argsArr = [{}, null, "3"]\n<strong>Output:</strong> 3\n<strong>Explanation:</strong> \nargumentsLength({}, null, "3"); // 3\n\nThree values were passed to the function so it should return 3.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>argsArr is a valid JSON array</code></li>\n\t<li><code>0 <= argsArr.length <= 100</code></li>\n</ul>\n",
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 23,
|
||||
"dislikes": 8,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "[5]\n[{},null,\"3\"]",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
"lang": "JavaScript",
|
||||
"langSlug": "javascript",
|
||||
"code": "/**\n * @return {number}\n */\nvar argumentsLength = function(...args) {\n \n};\n\n/**\n * argumentsLength(1, 2, 3); // 3\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "TypeScript",
|
||||
"langSlug": "typescript",
|
||||
"code": "function argumentsLength(...args: any[]): number {\n\n};\n\n/**\n * argumentsLength(1, 2, 3); // 3\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"2.6K\", \"totalSubmission\": \"2.7K\", \"totalAcceptedRaw\": 2551, \"totalSubmissionRaw\": 2723, \"acRate\": \"93.7%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "[5]",
|
||||
"metaData": "{\n \"name\": \"argumentsLength\",\n \"params\": [\n {\n \"type\": \"string\",\n \"name\": \"argsArr\"\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
56
leetcode/originData/to-be-or-not-to-be.json
Normal file
56
leetcode/originData/to-be-or-not-to-be.json
Normal file
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"data": {
|
||||
"question": {
|
||||
"questionId": "2813",
|
||||
"questionFrontendId": "2704",
|
||||
"boundTopicId": null,
|
||||
"title": "To Be Or Not To Be",
|
||||
"titleSlug": "to-be-or-not-to-be",
|
||||
"content": "<p>Write a function <code>expect</code> that helps developers test their code. It should take in any value <code>val</code> and return an object with the following two functions.</p>\n\n<ul>\n\t<li><code>toBe(val)</code> accepts another value and returns <code>true</code> if the two values <code>===</code> each other. If they are not equal, it should throw an error <code>"Not Equal"</code>.</li>\n\t<li><code>notToBe(val)</code> accepts another value and returns <code>true</code> if the two values <code>!==</code> each other. If they are equal, it should throw an error <code>"Equal"</code>.</li>\n</ul>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> func = () => expect(5).toBe(5)\n<strong>Output:</strong> {"value": true}\n<strong>Explanation:</strong> 5 === 5 so this expression returns true.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> func = () => expect(5).toBe(null)\n<strong>Output:</strong> {"error": "Not Equal"}\n<strong>Explanation:</strong> 5 !== null so this expression throw the error "Not Equal".\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> func = () => expect(5).notToBe(null)\n<strong>Output:</strong> {"value": true}\n<strong>Explanation:</strong> 5 !== null so this expression returns true.\n</pre>\n",
|
||||
"translatedTitle": null,
|
||||
"translatedContent": null,
|
||||
"isPaidOnly": false,
|
||||
"difficulty": "Easy",
|
||||
"likes": 24,
|
||||
"dislikes": 1,
|
||||
"isLiked": null,
|
||||
"similarQuestions": "[]",
|
||||
"exampleTestcases": "() => expect(5).toBe(5)\n() => expect(5).toBe(null)\n() => expect(5).notToBe(null)",
|
||||
"categoryTitle": "JavaScript",
|
||||
"contributors": [],
|
||||
"topicTags": [],
|
||||
"companyTagStats": null,
|
||||
"codeSnippets": [
|
||||
{
|
||||
"lang": "JavaScript",
|
||||
"langSlug": "javascript",
|
||||
"code": "/**\n * @param {string} val\n * @return {Object}\n */\nvar expect = function(val) {\n \n};\n\n/**\n * expect(5).toBe(5); // true\n * expect(5).notToBe(5); // throws \"Equal\"\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
},
|
||||
{
|
||||
"lang": "TypeScript",
|
||||
"langSlug": "typescript",
|
||||
"code": "type ToBeOrNotToBe = {\n toBe: (val: any) => boolean;\n notToBe: (val: any) => boolean;\n};\n\nfunction expect(val: any): ToBeOrNotToBe {\n\n};\n\n/**\n * expect(5).toBe(5); // true\n * expect(5).notToBe(5); // throws \"Equal\"\n */",
|
||||
"__typename": "CodeSnippetNode"
|
||||
}
|
||||
],
|
||||
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"1.8K\", \"totalAcceptedRaw\": 1262, \"totalSubmissionRaw\": 1823, \"acRate\": \"69.2%\"}",
|
||||
"hints": [],
|
||||
"solution": null,
|
||||
"status": null,
|
||||
"sampleTestCase": "() => expect(5).toBe(5)",
|
||||
"metaData": "{\n \"name\": \"expect\",\n \"params\": [\n {\n \"name\": \"func\",\n \"type\": \"string\"\n }\n ],\n \"return\": {\n \"type\": \"integer\"\n },\n \"manual\": true,\n \"languages\": [\n \"javascript\",\n \"typescript\"\n ]\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 4.5.4, 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 ES2020 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"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user