leetcode

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

commit6a9ed3ce45dc84c90a35703482b57f9949f78bd9
parent3c04fc7678a1a319974f793e4f33052ba87c720f
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateMon, 19 Jun 2023 08:26:58 +0200

Daily Problem

Diffstat:
AProblems/1732.cpp|++++++++
MREADME.md|+

2 files changed, 9 insertions(+), 0 deletions(-)


diff --git a/Problems/1732.cpp b/Problems/1732.cpp

@@ -0,0 +1,8 @@

class Solution {
public:
int largestAltitude(const vector<int> &gain) {
int maxi = 0, crnt = 0;
for (int n : gain) maxi = max(maxi, crnt += n);
return maxi;
}
};

diff --git a/README.md b/README.md

@@ -503,6 +503,7 @@ for solving problems.

| 1706 | Medium | [Where Will the Ball Fall](Problems/1706.cpp) |
| 1721 | Medium | [Swapping Nodes in a Linked List](Problems/1721.cpp) |
| 1722 | Medium | [Minimize Hamming Distance After Swap Operations](Problems/1722.cpp) |
| 1732 | Easy | [Find the Highest Altitude](Problems/1732.cpp) |
| 1768 | Easy | [Merge Strings Alternately](Problems/1768.cpp) |
| 1786 | Medium | [Number of Restricted Paths From First to Last Node](Problems/1786.cpp) |
| 1791 | Easy | [Find Center of Star Graph](Problems/1791.cpp) |