-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1431. Kids With the Greatest Number of Candies Leet Code #97
- Loading branch information
1 parent
af2db21
commit 82b7a48
Showing
1 changed file
with
17 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...hms/LeetCode.Algorithms/LeetCode.Algorithms/K/Kids With the Greatest Number of Candies.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace LeetCode.Algorithms; | ||
|
||
public class Kids_With_the_Greatest_Number_of_Candies | ||
{ | ||
public IList<bool> KidsWithCandies(int[] candies, int extraCandies) | ||
{ | ||
var maxAdjusted = candies.Max() - extraCandies; | ||
return candies.Select(_ => _ >= maxAdjusted).ToList(); | ||
} | ||
} |