LeetCode/java/number-of-senior-citizens.java
Matej Focko 649c2f92fa
java: add «2678. Number of Senior Citizens»
Signed-off-by: Matej Focko <me@mfocko.xyz>
2024-08-01 11:28:43 +02:00

15 lines
260 B
Java

class Solution {
public int countSeniors(String[] details) {
int count = 0;
for (String citizen : details) {
var age = Integer.parseInt(citizen.substring(11, 13));
if (age > 60) {
++count;
}
}
return count;
}
}