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
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
C++
Accepted on LeetCode — runtime 0ms, memory 17.2MB, accepted 2025-12-27.
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;
}
};