Single Pass || Check Pair - O(N) Time and Constant Space
Algorithm:\n+ Make array of pair of size 26.\n+ For every index corresponding to its lowercase has two places -> one for lower and one for upper, Just mark corr
**Algorithm**:\n+ Make array of pair of size 26.\n+ For every index corresponding to its lowercase has two places -> one for lower and one for upper, Just mark corresponding place\n+ When we encounter the character with both upper and lower as true, keep updating maximum.\n# C++  \n    string greatestLetter(string s) {\n        string ans="";\n        pair<bool,bool> cnt[26];\n        for(auto i:s){\n\t\t    char up= toupper(i), lw= tolower(i);\n            if(islower(i)) cnt[lw-\'a\'].first=true;     else cnt[lw-\'a\'].second=true;\n\t\t\t//if both are true\n            if(cnt[lw-\'a\'].first and cnt[lw-\'a\'].second) ans= max(ans,{up});\n        }\n        return ans;\n    }\n**Time** - O(N)\n**Space** - O(26) = O(1)
['C']