Created
June 14, 2025 15:29
-
-
Save psy901/2093e3da8e2a3b3ddfe795525bfb2712 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| fun kidsWithCandies(candies: IntArray, extraCandies: Int): List<Boolean> { | |
| // find the maximum | |
| val max = candies.max() | |
| // iterate the list | |
| val result = candies.map { it -> | |
| it + extraCandies >= max | |
| } | |
| // if the current number is less than the max, false | |
| return result | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment