摘要:
题目 这道题不会,看了卡哥思路,卡哥提供了三种方法。 方法一:暴力解法 自己写的代码: class Solution { public: bool repeatedSubstringPattern(string s) { int n = s.size(); for (int len = 1; len 阅读全文
摘要:
题目 自己写的: class Solution { public: string reverseStr(string s, int k) { int n = s.size(); int cnt = 1; while (cnt * 2 * k <= n) { int t = (cnt - 1) * 2 阅读全文
摘要:
题目 这道题很简单了,自己写的: class Solution { public: void reverseString(vector<char>& s) { int n = s.size(); for (int i = 0; i < n / 2; ++i) { char tmp; tmp = s[ 阅读全文