Simple and Easy to Understand Solution [JS] !! Beats 100.00% 🎉
Code\n\n\n\nvar greatestLetter = function(s) {\n   let upperSet = new Set();\n   let lowerSet = new Set();\n\n    for (let char of s) {\n        if (char >= \'A
# Code\n![leetcodeSS.png](https://assets.leetcode.com/users/images/d2d0cfcb-edc4-4d11-964d-1621ea3edc0c_1718007675.2028854.png)\n```\n\nvar greatestLetter = function(s) {\n   let upperSet = new Set();\n   let lowerSet = new Set();\n\n    for (let char of s) {\n        if (char >= \'A\' && char <= \'Z\') {\n            upperSet.add(char);\n        } \n        else if (char >= \'a\' && char <= \'z\') {\n            lowerSet.add(char);\n        }\n    }\n\n   const alphabet = \'ABCDEFGHIJKLMNOPQRSTUVWXYZ\';\n    for (let i = alphabet.length - 1; i >= 0; i--) {\n        let upperChar = alphabet[i];\n        let lowerChar = alphabet[i].toLowerCase();\n        \n        if (upperSet.has(upperChar) && lowerSet.has(lowerChar)) {\n            return upperChar;\n        }\n    }\n\n    return "";\n};\n```
['JavaScript']