#2678
Number of Senior Citizens
newbie · 165 · lc easy +14 · verified · 81.3% accepted · 789 likes · top 93%
Description
You are given a 0-indexed string array details where each 15-character string encodes: characters 0–9 (phone number), character 10 (gender), characters 11–12 (age), and characters 13–14 (seat). Return the count of passengers whose age is strictly greater than 60.
Example 1:
Input: details = ["7868190130M7522","5303914400F9211","9273338290F4010"]
Output: 2
Explanation: The passengers at indices 0, 1, and 2 have ages 75, 92, and 40. Thus, there are 2 people who are over 60 years old.
Example 2:
Input: details = ["1313579440F2036","2921522980M5644"]
Output: 0
Explanation: None of the passengers are older than 60.
Code
1
2
3