leetcode

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

commit 7ec62407f51f619688588761ec7ebb034051f842
parent 6de108a5eb9bb82f24b8c410b5d0368482b94caf
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Mon,  8 Jan 2024 14:40:50 +0000

1 Random Problem

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

diff --git a/Problems/1798.cpp b/Problems/1798.cpp @@ -0,0 +1,12 @@ +class Solution { + public: + int getMaximumConsecutive(vector<int> &coins) const { + sort(begin(coins), end(coins)); + int res = 1; + for (const int c : coins) { + if (c > res) break; + res += c; + } + return res; + } +}; diff --git a/README.md b/README.md @@ -842,6 +842,7 @@ for solving problems. | 1791 | Easy | [Find Center of Star Graph](Problems/1791.cpp) | | 1793 | Hard | [Maximum Score of a Good Subarray](Problems/1793.cpp) | | 1795 | Easy | [Rearrange Products Table](Problems/1795.cpp) | +| 1798 | Medium | [Maximum Number of Consecutive Values You Can Make](Problems/1798.cpp) | | 1799 | Medium | [Maximize Score After N Operations](Problems/1799.cpp) | | 1802 | Medium | [Maximum Value at a Given Index in a Bounded Array](Problems/1802.cpp) | | 1806 | Medium | [Minimum Number of Operations to Reinitialize a Permutation](Problems/1806.cpp) |