Easy Approach in Java | Detailed explained |🔥🔥✔
Intuition\nTake a substring and convert to Integer.\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n1) Iterate through all the stri
# Intuition\nTake a substring and convert to Integer.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n1) Iterate through all the strings in details and take a substring(startIndex, endIndex)(11, 13).\n2) Convert that string into Integer to get age.\n3) Comapre if greater than 60.\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n- $$O(n)$$\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n- $$O(1)$$\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int countSeniors(String[] details) {\n        int n = details.length, a = 0, count = 0;\n        for(int i = 0; i < n; i++){\n            String s = details[i].substring(11, 13);\n            a = Integer.parseInt(s);\n            if(a > 60)\n                count++;\n        }\n        return count;\n    }\n}\n```
['Java']