1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode/originData/is-object-empty.json

63 lines
5.1 KiB
JSON
Raw Normal View History

2023-06-12 23:05:37 +08:00
{
"data": {
"question": {
"questionId": "2864",
"questionFrontendId": "2727",
"boundTopicId": null,
"title": "Is Object Empty",
"titleSlug": "is-object-empty",
2023-12-09 18:42:21 +08:00
"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&nbsp;<code>JSON.parse</code>.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> obj = {&quot;x&quot;: 5, &quot;y&quot;: 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&#39;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>&nbsp;</p>\n<p><strong>Constraints:</strong></p>\n\n<ul>\n\t<li><code>obj</code> is a valid JSON object or array</li>\n\t<li><code>2 &lt;= JSON.stringify(obj).length &lt;= 10<sup>5</sup></code></li>\n</ul>\n\n<p>&nbsp;</p>\n<strong>Can you solve it in O(1) time?</strong>",
2023-06-12 23:05:37 +08:00
"translatedTitle": null,
"translatedContent": null,
"isPaidOnly": false,
"difficulty": "Easy",
2023-12-09 18:42:21 +08:00
"likes": 138,
"dislikes": 7,
2023-06-12 23:05:37 +08:00
"isLiked": null,
"similarQuestions": "[]",
"exampleTestcases": "{\"x\": 5, \"y\": 42}\n{}\n[null, false, 0]",
"categoryTitle": "JavaScript",
"contributors": [],
"topicTags": [],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "JavaScript",
"langSlug": "javascript",
2023-12-09 18:42:21 +08:00
"code": "/**\n * @param {Object|Array} obj\n * @return {boolean}\n */\nvar isEmpty = function(obj) {\n \n};",
2023-06-12 23:05:37 +08:00
"__typename": "CodeSnippetNode"
},
{
"lang": "TypeScript",
"langSlug": "typescript",
2023-12-09 18:42:21 +08:00
"code": "type JSONValue = null | boolean | number | string | JSONValue[] | { [key: string]: JSONValue };\ntype Obj = Record<string, JSONValue> | JSONValue[]\n\nfunction isEmpty(obj: Obj): boolean {\n\t\n};",
2023-06-12 23:05:37 +08:00
"__typename": "CodeSnippetNode"
}
],
2023-12-09 18:42:21 +08:00
"stats": "{\"totalAccepted\": \"27.6K\", \"totalSubmission\": \"35.6K\", \"totalAcceptedRaw\": 27634, \"totalSubmissionRaw\": 35633, \"acRate\": \"77.6%\"}",
2023-06-12 23:05:37 +08:00
"hints": [],
2023-12-09 18:42:21 +08:00
"solution": {
"id": "1993",
"canSeeDetail": true,
"paidOnly": false,
"hasVideoSolution": false,
"paidOnlyVideo": true,
"__typename": "ArticleNode"
},
2023-06-12 23:05:37 +08:00
"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,
2023-12-09 18:42:21 +08:00
"envInfo": "{\"javascript\": [\"JavaScript\", \"<p><code>Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES6 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\\r\\n\\r\\n<p>For Priority Queue / Queue data structures, you may use 5.3.0 version of <a href=\\\"https://github.com/datastructures-js/priority-queue/tree/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\">datastructures-js/priority-queue</a> and 4.2.1 version of <a href=\\\"https://github.com/datastructures-js/queue/tree/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\">datastructures-js/queue</a>.</p>\"], \"typescript\": [\"Typescript\", \"<p><code>TypeScript 5.1.6, Node.js 16.13.2</code>.</p>\\r\\n\\r\\n<p>Your code is run with <code>--harmony</code> flag, enabling <a href=\\\"http://node.green/\\\" target=\\\"_blank\\\">new ES2022 features</a>.</p>\\r\\n\\r\\n<p><a href=\\\"https://lodash.com\\\" target=\\\"_blank\\\">lodash.js</a> library is included by default.</p>\"]}",
2023-06-12 23:05:37 +08:00
"libraryUrl": null,
"adminUrl": null,
"challengeQuestion": null,
"__typename": "QuestionNode"
}
}
}