diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..722d5e7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode diff --git a/cpp/.gitignore b/cpp/.gitignore deleted file mode 100644 index 600d2d3..0000000 --- a/cpp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.vscode \ No newline at end of file diff --git a/cpp/test.cpp b/cpp/test.cpp deleted file mode 100644 index c52986a..0000000 --- a/cpp/test.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include -using namespace std; -class Solution { -public: - string replaceSpace(string s) { - int count = 0; - int lenth = s.size(); - for(auto i = 0; i < lenth; ++i){ - if(s[i] == ' '){ - count = count + 1; - } - } - s.resize(s.size() + 2 * count); - for(int i = lenth - 1, j = s.size() - 1; i < j; --i, --j){ - if (s[i] != ' ') - s[j] = s[i]; - else { - s[j - 2] = '%'; - s[j - 1] = '2'; - s[j] = '0'; - j -= 2; - } - } - return s; - } -}; - -int main(){ - string s = "We are happy."; - Solution test; - cout<