leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

commit 1d5b88ed1ba85ff6c71073dd5fbdf7b4e6896b68
parent c7a29829ceddc7bb16a29e2fdc0fd8f7e0cb4bca
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Mon, 23 Oct 2023 23:56:28 +0000

Random Problem

Diffstat:
AProblems/1895.cpp | 12++++++++++++
MREADME.md | 1+
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Problems/1895.cpp b/Problems/1895.cpp @@ -0,0 +1,12 @@ +class Solution { + public: + int minProcessingTime(vector<int> &processorTime, vector<int> &tasks) { + sort(begin(processorTime), end(processorTime)); + sort(begin(tasks), end(tasks)); + int res = 0; + for (int i = 0; i < tasks.size(); i++) { + res = max(res, processorTime[i >> 2] + tasks[tasks.size() - i - 1]); + } + return res; + } +}; diff --git a/README.md b/README.md @@ -880,4 +880,5 @@ for solving problems. | 2785 | Medium | [Sort Vowels in a String](Problems/2785.cpp) | | 2799 | Medium | [Count Complete Subarrays in an Array](Problems/2799.cpp) | | 2807 | Medium | [Insert Greatest Common Divisors in Linked List](Problems/2807.cpp) | +| 2895 | Medium | [Minimum Processing Time](Problems/2895.cpp) | | 2900 | Medium | [Longest Unequal Adjacent Groups Subsequence I](Problems/2900.cpp) |