Skip to content

Commit f6168c3

Browse files
authored
Create 1431-kids-with-the-greatest-number-of-candies.kt
1 parent ac6ad54 commit f6168c3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
fun kidsWithCandies(candies: IntArray, extraCandies: Int): List<Boolean> {
3+
val max = candies.max()!!
4+
val res = LinkedList<Boolean>()
5+
6+
for (candy in candies) {
7+
if(candy + extraCandies >= max) {
8+
res.addLast(true)
9+
} else {
10+
res.addLast(false)
11+
}
12+
}
13+
14+
return res
15+
}
16+
}

0 commit comments

Comments
 (0)