O(n) Solution
Just made Two arrays of 26 length to mark the presence of A Uppercase and lowercase Character.\nThen checked them from the last to find the greatest one\uD83D\u
Just made Two arrays of 26 length to mark the presence of A Uppercase and lowercase Character.\nThen checked them from the last to find the greatest one\uD83D\uDE05.\n```\nclass Solution {\npublic:\n    string greatestLetter(string s) {\n        vector<int> A(26,0);\n        vector<int> a(26,0);\n        string x="";\n        for(int i=0;i<s.size();i++){\n            if(s[i]>=\'a\' && s[i]<=\'z\'){\n                a[s[i]-97]=1;\n            }\n            if(s[i]>=\'A\' && s[i]<=\'Z\'){\n                A[s[i]-65]=1;\n            }\n        }\n        for(int i=25;i>=0;i--){\n            if(A[i]==1 && a[i]==1){\n                x.push_back(char(\'A\'+i));\n                return x;\n            }\n        }\n        return x;\n    }\n};\n```
['C']