✔Very Easy C++ Solution | Number of Senior Citizens🔥
Intuition\nThe problem involves counting the number of seniors based on age information extracted from a list of strings. Each string in the list contains the d
# Intuition\nThe problem involves counting the number of seniors based on age information extracted from a list of strings. Each string in the list contains the details of an individual, and the age is stored in the 12th and 13th characters of each string.\n\n# Approach\n1. Initialize a counter variable to zero.\n2. Iterate through each string in the **details** vector.\n3. Extract the age substring from each string.\n4. Convert the extracted substring to an integer.\n5. Check if the age is greater than 60.\n6. If it is, increment the counter.\n7. Return the counter after iterating through all the strings.\n\n# Complexity\n- **Time complexity: O(n)**, where \uD835\uDC5B is the number of strings in the details vector. This is because we need to iterate through each string once.\n\n- **Space complexity: O(1)**, since we are only using a few additional variables for counting and extracting the age.\n- \n# Code\n```\nclass Solution {\npublic:\n    int countSeniors(vector<string>& details) {\n        int count = 0;\n        for (string detail: details) {\n            string age = { detail[11], detail[12] };\n            if (age > "60") {\n                count++;\n            }\n        }\n        return count;\n    }\n};\n```
['C++']