2678. Number of Senior Citizens ¶ Time: $O(n)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6 7 8class Solution { public: int countSeniors(vector<string>& details) { return ranges::count_if(details, [](const string& detail) { return stoi(detail.substr(11, 2)) > 60; }); } }; 1 2 3 4 5 6 7class Solution { public int countSeniors(String[] details) { return (int) Arrays.stream(details) .filter(detail -> Integer.parseInt(detail.substring(11, 13)) > 60) .count(); } } 1 2 3class Solution: def countSeniors(self, details: list[str]) -> int: return sum(int(detail[11:13]) > 60 for detail in details)