Skip to content

Commit

Permalink
Create 1431-kids-with-the-greatest-number-of-candies.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
a93a authored Apr 17, 2023
1 parent ac6ad54 commit f6168c3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions kotlin/1431-kids-with-the-greatest-number-of-candies.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
class Solution {
fun kidsWithCandies(candies: IntArray, extraCandies: Int): List<Boolean> {
val max = candies.max()!!
val res = LinkedList<Boolean>()

for (candy in candies) {
if(candy + extraCandies >= max) {
res.addLast(true)
} else {
res.addLast(false)
}
}

return res
}
}

0 comments on commit f6168c3

Please sign in to comment.