✅Well Explained || Easy to Understand || C++ code💥
Intuition\n Describe your first thoughts on how to solve this problem. \nAs it given that the 12th and the 13th position of each string is denoting the age of t
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nAs it given that the 12th and the 13th position of each string is denoting the age of the passenger so we can get the age of each passenger from that position and then we can find out total number of passengers who are older than 60. \n# Approach\n<!-- Describe your approach to solving the problem. -->\n- Loop through the given string type vector and get the char at index 11 and 12 . Store char of 11th index in a variable (dec) and store char of 12th index in a variable (uni).\n- Convert them into integer (char-\'0\')\n- Find out the age (age = (dec*10)+uni)\n- Store age of each passenger in a integer type vector(ageList)\n- Then find out count of the passengers who are strictly older than 60.\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\nAt first it is looping through the given vector to find out their age, which will take O(n)\nThen it is looping through the created vector (ageList) to find out the count of people who are older than 60, it will also take O(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\nIf the size of the given vector is \'n\', then size of the vector which we have created (ageList), will also be n.\n# Code\n```\nclass Solution {\npublic:\n    int countSeniors(vector<string>& details) {\n        int n=details.size();\n        vector<int>age;\n        for(int i=0;i<n;i++){\n            string given=details[i];\n            char char11=given.at(11);\n            char char12=given.at(12);\n            \n            int dec=char11-\'0\';\n            int uni=char12-\'0\';\n            int num=(dec*10)+uni;\n            age.push_back(num);\n        }\n        int cnt=0;\n        for(int i=0;i<age.size();i++){\n            if(age[i]>60){\n                cnt++;\n            }\n        }\n        return cnt;\n    }\n};\n```\n# One like can be really encouraging\u2B06\uFE0F
['C++']