Title: #2895 - Minimum Processing Time - LeetCode JavaScript Solutions
Open Graph Title: #2895 - Minimum Processing Time - LeetCode JavaScript Solutions
X Title: #2895 - Minimum Processing Time - LeetCode JavaScript Solutions
Description: You have a certain number of processors, each having 4 cores. The number of tasks to be executed is four times the number of processors. Eac...
Open Graph Description: You have a certain number of processors, each having 4 cores. The number of tasks to be executed is four times the number of processors. Eac...
X Description: You have a certain number of processors, each having 4 cores. The number of tasks to be executed is four times the number of processors. Eac...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/minimum-processing-time
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/minimum-processing-time","name":"#2895 - Minimum Processing Time - LeetCode JavaScript Solutions","description":"You have a certain number of processors, each having 4 cores. The number of tasks to be executed is four times the number of processors. Eac...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number[]} processorTime\n * @param {number[]} tasks\n * @return {number}\n */\nvar minProcessingTime = function(processorTime, tasks) {\n tasks.sort((a, b) => b - a);\n processorTime.sort((a, b) => a - b);\n let result = 0;\n\n for (let i = 0; i < processorTime.length; i++) {\n for (let j = 0; j < 4; j++) {\n const taskIndex = i * 4 + j;\n result = Math.max(result, processorTime[i] + tasks[taskIndex]);\n }\n }\n\n return result;\n};","keywords":"LeetCode 2895, #2895 - Minimum Processing Time, Medium, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/minimum-processing-time |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/minimum-processing-time/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/2895-minimum-processing-time.js |
| Array | https://leetcodejavascript.com/tags/array |
| Sorting | https://leetcodejavascript.com/tags/sorting |
| Greedy | https://leetcodejavascript.com/tags/greedy |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width, initial-scale=1.0
Robots: index, follow