2678. Number of Senior Citizens Easy
1/**
2 * [2678] Number of Senior Citizens
3 *
4 * You are given a 0-indexed array of strings details. Each element of details provides information about a given passenger compressed into a string of length 15. The system is such that:
5 *
6 * The first ten characters consist of the phone number of passengers.
7 * The next character denotes the gender of the person.
8 * The following two characters are used to indicate the age of the person.
9 * The last two characters determine the seat allotted to that person.
10 *
11 * Return the number of passengers who are strictly more than 60 years old.
12 *
13 * <strong class="example">Example 1:
14 *
15 * Input: details = ["7868190130M7522","5303914400F9211","9273338290F4010"]
16 * Output: 2
17 * 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.
18 *
19 * <strong class="example">Example 2:
20 *
21 * Input: details = ["1313579440F2036","2921522980M5644"]
22 * Output: 0
23 * Explanation: None of the passengers are older than 60.
24 *
25 *
26 * Constraints:
27 *
28 * 1 <= details.length <= 100
29 * details[i].length == 15
30 * details[i] consists of digits from '0' to '9'.
31 * details[i][10] is either 'M' or 'F' or 'O'.
32 * The phone numbers and seat numbers of the passengers are distinct.
33 *
34 */
35pub struct Solution {}
36
37// problem: https://leetcode.com/problems/number-of-senior-citizens/
38// discuss: https://leetcode.com/problems/number-of-senior-citizens/discuss/?currentPage=1&orderBy=most_votes&query=
39
40// submission codes start here
41
42impl Solution {
43 pub fn count_seniors(details: Vec<String>) -> i32 {
44 0
45 }
46}
47
48// submission codes end
49
50#[cfg(test)]
51mod tests {
52 use super::*;
53
54 #[test]
55 fn test_2678() {
56 }
57}
58
Back
© 2025 bowen.ge All Rights Reserved.