diff options
Diffstat (limited to 'other/make_string_great.cpp')
-rw-r--r-- | other/make_string_great.cpp | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/other/make_string_great.cpp b/other/make_string_great.cpp deleted file mode 100644 index 190bbed..0000000 --- a/other/make_string_great.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - string makeGood(string s) { - int n = s.size(); - if (n < 2) - return s; - while (n > 1) { - bool pair = false; - for (int i = 0; i < n; i++) { - char curr = s[i], next = s[i + 1]; - if (abs(curr - next) == 32) { - s = s.substr(0, i) + s.substr(i + 2); - pair = true; - break; - } - } - if (!pair) - break; - } - return s; - } -}; - -int main() { - Solution obj; - cout << obj.makeGood("HhvmLxpqQPXlMVQWwq"); -} |