Skip to content

Instantly share code, notes, and snippets.

@psy901
Created June 14, 2025 15:29
Show Gist options
  • Save psy901/2093e3da8e2a3b3ddfe795525bfb2712 to your computer and use it in GitHub Desktop.
Save psy901/2093e3da8e2a3b3ddfe795525bfb2712 to your computer and use it in GitHub Desktop.
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