Leetcode剑指 Offer 58 - II. 左旋转字符串

暴力解


class Solution {
    
    
public:
    string reverseLeftWords(string s, int n) {
    
    
        string str;
        for(int i =n; i < s.length(); i++){
    
    
            str.push_back(s[i]);
        }
        for(int i = 0; i < n ; i ++){
    
    
            str.push_back(s[i]);
        }
        
        
        return str;
    }
};

算法就到此结束了,如果你觉得还不错的,麻烦动动小手,点个赞再走!

猜你喜欢

转载自blog.csdn.net/weixin_43579015/article/details/123322703
今日推荐