Number of Senior Citizens

You are given a 0-indexed array of strings details. Each string is 15 characters long and describes one passenger: the first ten characters are the phone number, the next character is the gender, the following two characters are the age, and the last two characters are the seat. Return the number of passengers who are strictly more than 60 years old.

30:00

Number of Senior Citizens
easy
Free written solution
Topics
Companies

You are given a 0-indexed array of strings details. Each string is 15 characters long and describes one passenger: the first ten characters are the phone number, the next character is the gender, the following two characters are the age, and the last two characters are the seat. Return the number of passengers who are strictly more than 60 years old.

Example 1:
Input: {"details":["7868190130M7522","5303914400F9211","9273338290F4010"]}
Output: 2
Constraints:
  • 1≤details.length≤1001 \leq \text{details.length} \leq 100

  • details[i].length==15\text{details}[i].\text{length} == 15

  • details[i]\text{details}[i] consists of digits, except details[i][10]\text{details}[i][10] which is 'M', 'F' or 'O'.

  • Phone numbers and seat numbers of the passengers are distinct.

Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result

Run code to see results.

Input
arr ={"details":["7868190130M7522","5303914400F9211","9273338290F4010"]}

3 tickets. On every ticket the age sits at characters 11 and 12, right after the gender letter.

age vs 60

0

60

99

seniors

0

tickets

0

7
8
6
8
1
9
0
1
3
0
M
7
5
2
2

1

5
3
0
3
9
1
4
4
0
0
F
9
2
1
1

2

9
2
7
3
3
3
8
2
9
0
F
4
0
1
0

Variables
VariableValue
count0
DepthFunction Call
Stack empty
0/7