commit 1ef59548b1c0221014ad9d25f8a23c594ee2fdba
parent 77d39a7643896b4c7fb67b6f83ce8ae8297258a1
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Mon, 17 Apr 2023 20:26:38 +0200
Daily Problem
Diffstat:
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/Problems/1431.cpp b/Problems/1431.cpp
@@ -0,0 +1,10 @@
+class Solution {
+public:
+ vector<bool> kidsWithCandies(vector<int> &candies, int extraCandies) {
+ int maxi = *max_element(candies.begin(), candies.end());
+ vector<bool> res(candies.size());
+ for (int i = 0; i < candies.size(); i++)
+ res[i] = (maxi - candies[i]) <= extraCandies;
+ return res;
+ }
+};
diff --git a/README.md b/README.md
@@ -428,6 +428,7 @@ for solving problems.
| 1382 | Medium | [Balance a Binary Search Tree](Problems/1382.cpp) |
| 1402 | Hard | [Reducing Dishes](Problems/1402.cpp) |
| 1425 | Hard | [Constrained Subsequence Sum](Problems/1425.cpp) |
+| 1431 | Easy | [Kids With the Greatest Number of Candies](Problems/1431.cpp) |
| 1436 | Easy | [Destination City](Problems/1436.cpp) |
| 1438 | Medium | [Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit](Problems/1438.cpp) |
| 1443 | Medium | [Minimum Time to Collect All Apples in a Tree](Problems/1443.cpp) |