💢☠💫Easiest👾Faster✅💯 Lesser🧠 🎯 C++✅Python3🐍✅Java✅C✅Python🐍✅C#✅💥🔥💫Explained☠💥🔥 Beats 💯
Intuition\n\n\n\n\n\n\nC# []\npublic class Solution {\n    public int CountSeniors(string[] details) {\n        var cnt = 0;\n        foreach(string st in detai
# Intuition\n![0ehh83fsnh811.jpg](https://assets.leetcode.com/users/images/f226764b-02e0-49ac-ba64-b5bef7c909d7_1722503425.6567588.jpeg)\n![Screenshot 2024-01-23 190453.png](https://assets.leetcode.com/users/images/71ad5b0d-7696-4708-87e9-35d36142bf45_1706017035.5365858.png)\n![Screenshot 2024-08-01 142432.png](https://assets.leetcode.com/users/images/bdf804b1-dbb4-41df-95e1-65c6a5123b98_1722503518.366885.png)\n![Screenshot 2024-08-01 141044.png](https://assets.leetcode.com/users/images/cce92344-e3a2-4d9c-84a1-9732bcf338d8_1722503530.0492778.png)\n![Screenshot 2024-08-01 120630.png](https://assets.leetcode.com/users/images/dfd361ea-529c-4004-b11f-0ce8b2345a51_1722503732.1256812.png)\n![Screenshot 2024-08-01 115826.png](https://assets.leetcode.com/users/images/62b456d2-9390-430e-ba5d-95fa7f46c741_1722503875.0495987.png)\n```C# []\npublic class Solution {\n    public int CountSeniors(string[] details) {\n        var cnt = 0;\n        foreach(string st in details){\n            int age = Int32.Parse(st.Substring(11, 2));\n            if(age > 60)\n                cnt++;\n        }\n        return cnt;\n    }\n}\n```\n```JavaScript []\n/**\n * @param {string[]} details\n * @return {number}\n */\nvar countSeniors = function(details) {\n    var cnt = 0\n    for(let people of details){\n        let age = Number(people.substring(11, 13))\n        if(age > 60)\n            cnt++\n    }\n    return cnt\n};\n```\n```C []\nint countSeniors(char** details, int detailsSize) {\n    int age = 0, cnt = 0;\n    for (int i = 0; i < detailsSize; i++) {\n        char* curr = details[i];\n        age = ((curr[11] - \'0\') * 10) + (curr[12] - \'0\');\n        if (age > 60)\n            cnt++;\n    }\n    return cnt;\n}\n```\n```Python3 []\nclass Solution:\n    def countSeniors(self, details: List[str]) -> int:\n        ct = 0\n        for peoples in details:\n            age = int(peoples[11 : 13])\n            if age > 60:\n                ct += 1\n        return ct\n            \n```\n```Java []\nclass Solution {\n    public int countSeniors(String[] details) {\n        int cnt = 0;\n        for (String data : details) {\n            int age = Integer.parseInt(data.substring(11, 13));\n            if (age > 60)\n                cnt++;\n        }\n        return cnt;\n    }\n}\n```\n```Python []\nclass Solution(object):\n    def countSeniors(self, details):\n        """\n        :type details: List[str]\n        :rtype: int\n        """\n        count = 0\n        for person in details:\n            if int(person[11 : 13]) > 60:\n                count += 1\n        \n        return count\n```\n```C++ []\nclass Solution {\npublic:\n    int countSeniors(vector<string>& details) {\n        int count = 0;\n        for (string s : details) {\n            for (int i = 0; i < s.length(); i++) {\n                if (s[i] == \'M\' || s[i] == \'F\' || s[i] == \'O\') {\n                    string str = s.substr(i + 1, 2);\n                    int age = stoi(str);\n                    if (age > 60) {\n                        count++;\n                        break;\n                    }\n                }\n            }\n        }\n        return count;\n    }\n};\n```\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n      O(N)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n      O(1)\n# Code\n```\nint countSeniors(char** details, int detailsSize) {\n    int age = 0, cnt = 0;\n    for (int i = 0; i < detailsSize; i++) {\n        char* curr = details[i];\n        age = ((curr[11] - \'0\') * 10) + (curr[12] - \'0\');\n        if (age > 60)\n            cnt++;\n    }\n    return cnt;\n}\n```\n# Please upvot.. 1 like\n![th.jpeg](https://assets.leetcode.com/users/images/01c6ccd3-8e0b-4788-8aa0-452e79b637ef_1706017280.8318675.jpeg)\n
['Array', 'String', 'C', 'Python', 'C++', 'Java', 'Python3', 'JavaScript', 'C#']