2023-06-02 01:00:40 +08:00
{
"data" : {
"question" : {
"questionId" : "2773" ,
"questionFrontendId" : "2691" ,
"categoryTitle" : "JavaScript" ,
"boundTopicId" : 2275512 ,
"title" : "Immutability Helper" ,
"titleSlug" : "immutability-helper" ,
"content" : null ,
"translatedTitle" : "不可变辅助工具" ,
"translatedContent" : null ,
"isPaidOnly" : true ,
"difficulty" : "Hard" ,
"likes" : 0 ,
"dislikes" : 0 ,
"isLiked" : null ,
"similarQuestions" : "[]" ,
"contributors" : [ ] ,
"langToValidPlayground" : null ,
"topicTags" : [ ] ,
"companyTagStats" : null ,
"codeSnippets" : null ,
2023-12-09 18:42:21 +08:00
"stats" : "{\"totalAccepted\": \"69\", \"totalSubmission\": \"292\", \"totalAcceptedRaw\": 69, \"totalSubmissionRaw\": 292, \"acRate\": \"23.6%\"}" ,
2023-06-02 01:00:40 +08:00
"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 ,
2023-12-09 18:42:21 +08:00
"envInfo" : "{\"javascript\":[\"JavaScript\",\"<p>\\u7248\\u672c\\uff1a<code>Node.js 16.13.2<\\/code><\\/p>\\r\\n\\r\\n<p>\\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a <code>--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f <a href=\\\"http:\\/\\/node.green\\/\\\" target=\\\"_blank\\\">\\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\"<p>TypeScript 5.1.6<\\/p>\\r\\n\\r\\n<p>Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n<p><a href=\\\"https:\\/\\/lodash.com\\\" target=\\\"_blank\\\">lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n<p> \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/priority-queue\\/tree\\/fb4fdb984834421279aeb081df7af624d17c2a03\\\" target=\\\"_blank\\\"> datastructures-js\\/priority-queue@5.3.0<\\/a> \\u548c <a href=\\\"https:\\/\\/github.com\\/datastructures-js\\/queue\\/tree\\/e63563025a5a805aa16928cb53bcd517bfea9230\\\" target=\\\"_blank\\\"> datastructures-js\\/queue@4.2.1<\\/a>\\u3002<\\/p>\"]}" ,
2023-06-02 01:00:40 +08:00
"book" : null ,
"isSubscribed" : false ,
"isDailyQuestion" : false ,
"dailyRecordStatus" : null ,
"editorType" : "CKEDITOR" ,
"ugcQuestionId" : null ,
"style" : "LEETCODE" ,
"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; }]" ,
"__typename" : "QuestionNode"
}
}
}