java.lang.Object
g2601_2700.s2678_number_of_senior_citizens.Solution

public class Solution extends Object
2678 - Number of Senior Citizens.<p>Easy</p> <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</strong> <strong>more than 60 years old</strong>.</em></p> <p><strong>Example 1:</strong></p> <p><strong>Input:</strong> details = [&ldquo;7868190130M7522&rdquo;,&ldquo;5303914400F9211&rdquo;,&ldquo;9273338290F4010&rdquo;]</p> <p><strong>Output:</strong> 2</p> <p><strong>Explanation:</strong> 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.</p> <p><strong>Example 2:</strong></p> <p><strong>Input:</strong> details = [&ldquo;1313579440F2036&rdquo;,&ldquo;2921522980M5644&rdquo;]</p> <p><strong>Output:</strong> 0</p> <p><strong>Explanation:</strong> None of the passengers are older than 60.</p> <p><strong>Constraints:</strong></p> <ul> <li><code>1 <= details.length <= 100</code></li> <li><code>details[i].length == 15</code></li> <li><code>details[i] consists of digits from '0' to '9'.</code></li> <li><code>details[i][10] is either 'M' or 'F' or 'O'.</code></li> <li>The phone numbers and seat numbers of the passengers are distinct.</li> </ul>
  • Constructor Details

    • Solution

      public Solution()
  • Method Details

    • countSeniors

      public int countSeniors(String[] details)