diff --git a/PARTICIPANTS.md b/PARTICIPANTS.md index 5a2e2f4..d6f43eb 100644 --- a/PARTICIPANTS.md +++ b/PARTICIPANTS.md @@ -142,3 +142,11 @@ - šŸ”­ Connect with me: **[Piyushjar](https://github.com/piyushjar))** --- +### Connect with me: + + + +- šŸ‘Øā€šŸ’» My name is **Pratyush** +- 🌱 I’m a JavaScript Developer. +- šŸ“« Reach me: **pratyushraj7@gmail.com** +- šŸ”­ Connect with me: **[pratyushraj7](https://github.com/pratyushraj7))** diff --git a/cpp/Greatest-English-Letter-in-Upper-and-Lower-Case.cpp b/cpp/Greatest-English-Letter-in-Upper-and-Lower-Case.cpp new file mode 100644 index 0000000..29a5a9a --- /dev/null +++ b/cpp/Greatest-English-Letter-in-Upper-and-Lower-Case.cpp @@ -0,0 +1,23 @@ +class Solution { +public: + string greatestLetter(string s) { + string str = ""; + unordered_map map; + for(char c : s){ + map[c]++; + } + + sort(s.begin(), s.end()); + + for(int i=s.size()-1 ; i>=0 ; i--){ + char a = tolower(s[i]); + char b = toupper(s[i]); + + if(map.find(a) != map.end() and map.find(b) != map.end()){ + str = b; + break; + } + } + return str; + } +};