LeetCode solutions

2727. Number of Senior Citizens

My accepted C++ solution to LeetCode problem 2727, Number of Senior Citizens, running in 0ms.

  • Difficulty: Easy
  • C++
  • Runtime 0ms
  • Memory 17.2MB

Read the problem on LeetCode View on GitHub

C++

Accepted on LeetCode — runtime 0ms, memory 17.2MB, accepted 2025-12-27.

cpp
class Solution {
    public:
    int countSeniors(vector<string>& details) {
        int count = 0;
        for (const string& s : details) {
            int age = (s[11] - '0') * 10 + (s[12] - '0');
            if (age > 60) count++;
        }
        return count;
    }
};

Source