Skip to main content
LeetCode 2678, Easy. Topics: Array, String. View on LeetCode. Generate this problem as a practice environment: tested reference solution, 16 parametrized pytest cases, and a playground notebook:

Problem

<p>You are given a <strong>0-indexed</strong> array of strings <code>details</code>. Each element of <code>details</code> provides information about a given passenger compressed into a string of length <code>15</code>. The system is such that:</p> <ul> <li>The first ten characters consist of the phone number of passengers.</li> <li>The next character denotes the gender of the person.</li> <li>The following two characters are used to indicate the age of the person.</li> <li>The last two characters determine the seat allotted to that person.</li> </ul> <p>Return <em>the number of passengers who are <strong>strictly more than 60 years old</strong></em>.</p>

Examples

Constraints

  • 1 <= details.length <= 100
  • details[i].length == 15
  • details[i] consists of digits from '0' to '9'.
  • details[i][10] is either 'M', 'F', or 'O'.
  • The phone numbers and seat numbers of the passengers are distinct.

Solution

Reference implementation from solution.py on GitHub, full suite in test_solution.py:

Complexity

Tags

NeetCode All.
Last modified on September 7, 2026