mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
56 lines
4.7 KiB
JSON
56 lines
4.7 KiB
JSON
{
|
|
"data": {
|
|
"question": {
|
|
"questionId": "2864",
|
|
"questionFrontendId": "2727",
|
|
"boundTopicId": null,
|
|
"title": "Is Object Empty",
|
|
"titleSlug": "is-object-empty",
|
|
"content": "<p>Given an object or an array, return if it is empty.</p>\n\n<ul>\n\t<li>An empty object contains no key-value pairs.</li>\n\t<li>An empty array contains no elements.</li>\n</ul>\n\n<p>You may assume the object or array is the output of <code>JSON.parse</code>.</p>\n\n<p> </p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = {"x": 5, "y": 42}\n<strong>Output:</strong> false\n<strong>Explanation:</strong> The object has 2 key-value pairs so it is not empty.\n</pre>\n\n<p><strong class=\"example\">Example 2:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = {}\n<strong>Output:</strong> true\n<strong>Explanation:</strong> The object doesn't have any key-value pairs so it is empty.\n</pre>\n\n<p><strong class=\"example\">Example 3:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = [null, false, 0]\n<strong>Output:</strong> false\n<strong>Explanation:</strong> The array has 3 elements so it is not empty.\n</pre>\n\n<p> </p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li> <code>2 <= JSON.stringify(obj).length <= 10<sup>5</sup></code></li>\n</ul>\n\n<p> </p>\n<strong>Can you solve it in O(1) time?</strong>",
|
|
"translatedTitle": null,
|
|
"translatedContent": null,
|
|
"isPaidOnly": false,
|
|
"difficulty": "Easy",
|
|
"likes": 25,
|
|
"dislikes": 3,
|
|
"isLiked": null,
|
|
"similarQuestions": "[]",
|
|
"exampleTestcases": "{\"x\": 5, \"y\": 42}\n{}\n[null, false, 0]",
|
|
"categoryTitle": "JavaScript",
|
|
"contributors": [],
|
|
"topicTags": [],
|
|
"companyTagStats": null,
|
|
"codeSnippets": [
|
|
{
|
|
"lang": "JavaScript",
|
|
"langSlug": "javascript",
|
|
"code": "/**\n * @param {Object | Array} obj\n * @return {boolean}\n */\nvar isEmpty = function(obj) {\n \n};",
|
|
"__typename": "CodeSnippetNode"
|
|
},
|
|
{
|
|
"lang": "TypeScript",
|
|
"langSlug": "typescript",
|
|
"code": "function isEmpty(obj: Record<string, any> | any[]): boolean {\n\n};",
|
|
"__typename": "CodeSnippetNode"
|
|
}
|
|
],
|
|
"stats": "{\"totalAccepted\": \"1.3K\", \"totalSubmission\": \"1.6K\", \"totalAcceptedRaw\": 1321, \"totalSubmissionRaw\": 1598, \"acRate\": \"82.7%\"}",
|
|
"hints": [],
|
|
"solution": null,
|
|
"status": null,
|
|
"sampleTestCase": "{\"x\": 5, \"y\": 42}",
|
|
"metaData": "{\n \"name\": \"isEmpty\",\n \"params\": [\n {\n \"name\": \"obj\",\n \"type\": \"string\"\n }\n ],\n \"return\": {\n \"type\": \"boolean\"\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"
|
|
}
|
|
}
|
|
} |