{ "data": { "question": { "questionId": "2750", "questionFrontendId": "2636", "categoryTitle": "JavaScript", "boundTopicId": 2222268, "title": "Promise Pool", "titleSlug": "promise-pool", "content": null, "translatedTitle": "Promise 对象池", "translatedContent": null, "isPaidOnly": true, "difficulty": "Medium", "likes": 16, "dislikes": 0, "isLiked": null, "similarQuestions": "[{\"title\": \"Sleep\", \"titleSlug\": \"sleep\", \"difficulty\": \"Easy\", \"translatedTitle\": \"\\u7761\\u7720\\u51fd\\u6570\", \"isPaidOnly\": false}, {\"title\": \"Promise Time Limit\", \"titleSlug\": \"promise-time-limit\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6709\\u65f6\\u95f4\\u9650\\u5236\\u7684 Promise \\u5bf9\\u8c61\", \"isPaidOnly\": false}, {\"title\": \"Cache With Time Limit\", \"titleSlug\": \"cache-with-time-limit\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u6709\\u65f6\\u95f4\\u9650\\u5236\\u7684\\u7f13\\u5b58\", \"isPaidOnly\": false}, {\"title\": \"Throttle\", \"titleSlug\": \"throttle\", \"difficulty\": \"Medium\", \"translatedTitle\": \"\\u8282\\u6d41\", \"isPaidOnly\": true}]", "contributors": [], "langToValidPlayground": null, "topicTags": [], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"1.6K\", \"totalSubmission\": \"2.5K\", \"totalAcceptedRaw\": 1616, \"totalSubmissionRaw\": 2490, \"acRate\": \"64.9%\"}", "hints": [ "Initially execute all the functions until the queue fills up.", "Every time a function resolves, add a new promise to the queue if possible." ], "solution": null, "status": null, "sampleTestCase": "[() => new Promise(res => setTimeout(res, 300)), () => new Promise(res => setTimeout(res, 400)), () => new Promise(res => setTimeout(res, 200))]\n2", "metaData": "{\n \"name\": \"promisePool\",\n \"params\": [\n {\n \"name\": \"functions\",\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\",\n \"name\": \"n\"\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, "envInfo": "{\"javascript\":[\"JavaScript\",\"
\\u7248\\u672c\\uff1a \\u60a8\\u7684\\u4ee3\\u7801\\u5728\\u6267\\u884c\\u65f6\\u5c06\\u5e26\\u4e0a lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 datastructures-js\\/priority-queue@5.4.0<\\/a>\\uff0c datastructures-js\\/queue@4.2.3<\\/a> \\u4ee5\\u53ca datastructures-js\\/deque@1.0.4<\\/a>\\u3002<\\/p>\"],\"typescript\":[\"TypeScript\",\" TypeScript 5.1.6<\\/p>\\r\\n\\r\\n Compile Options: --alwaysStrict --strictBindCallApply --strictFunctionTypes --target ES2022<\\/p>\\r\\n\\r\\n lodash.js<\\/a> \\u5e93\\u5df2\\u7ecf\\u9ed8\\u8ba4\\u88ab\\u5305\\u542b\\u3002<\\/p>\\r\\n\\r\\n \\u5982\\u9700\\u4f7f\\u7528\\u961f\\u5217\\/\\u4f18\\u5148\\u961f\\u5217\\uff0c\\u60a8\\u53ef\\u4f7f\\u7528 datastructures-js\\/priority-queue@5.4.0<\\/a>\\uff0c datastructures-js\\/queue@4.2.3<\\/a> \\u4ee5\\u53ca datastructures-js\\/deque@1.0.4<\\/a>\\u3002<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "[() => new Promise(res => setTimeout(res, 300)), () => new Promise(res => setTimeout(res, 400)), () => new Promise(res => setTimeout(res, 200))]\n2\n[() => new Promise(res => setTimeout(res, 300)), () => new Promise(res => setTimeout(res, 400)), () => new Promise(res => setTimeout(res, 200))]\n5\n[() => new Promise(res => setTimeout(res, 300)), () => new Promise(res => setTimeout(res, 400)), () => new Promise(res => setTimeout(res, 200))]\n1",
"__typename": "QuestionNode"
}
}
}Node.js 20.10.0<\\/code><\\/p>\\r\\n\\r\\n
--harmony<\\/code> \\u6807\\u8bb0\\u6765\\u5f00\\u542f \\u65b0\\u7248ES6\\u7279\\u6027<\\/a>\\u3002<\\/p>\\r\\n\\r\\n