java: add «2678. Number of Senior Citizens»
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
adcfcd4d91
commit
649c2f92fa
1 changed files with 15 additions and 0 deletions
15
java/number-of-senior-citizens.java
Normal file
15
java/number-of-senior-citizens.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
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;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue