🔥0ms 100% Java||C++||Python Detailed explained✅ Beginner-friendly ^_^
Intuition\nThis is a simple ASCII to int problem\n\n## Approach\nFirst, we iterate through every string.\nWe get the 12th & 13th elements in every string.\nThen
## Intuition\nThis is a simple ASCII to int problem\n\n## Approach\nFirst, we iterate through every string.\nWe get the 12th & 13th elements in every string.\nThen, we use `char - \'0\'` to convert ASCII char to int.\nAfter checking whether age is more than 60, we can count the answer.\n\n## Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n## Code\n```java []\nclass Solution {\n    public int countSeniors(String[] details) {\n        int ans = 0;\n        for(int i=0; i<details.length; i++){\n            int age = (details[i].charAt(11) - \'0\') * 10 + (details[i].charAt(12) - \'0\');\n            if(age > 60) ans++;\n        }\n        return ans;\n    }\n}\n\n```\n\n```cpp []\nclass Solution {\npublic:\n    int countSeniors(vector<string>& details) {\n        int ans = 0;\n        for(int i=0; i<details.size(); i++){\n            int age = (details[i][11] - \'0\') * 10 + (details[i][12] - \'0\');\n            if(age > 60) ans++;\n        }\n        return ans;\n    }\n};\n```\n```python []\nclass Solution:\n    def countSeniors(self, details: List[str]) -> int:\n        ans = 0\n        for s in details:\n            if int(s[11:13]) > 60:\n                ans += 1\n        return ans\n        \n```\n# Please UPVOTE if this helps you~!!\n![Screenshot 2024-08-01 at 10.53.28\u202FAM.png](https://assets.leetcode.com/users/images/27b0906f-7764-4e62-ac6b-1be25faa6655_1722481565.886186.png)\n
['Array', 'String', 'C++', 'Java', 'Python3']