旋转字符串--leetcode--草稿
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* reverseLeftWords1(char* s, int n) {
int len = strlen(s), i = 0;;
char* ans = malloc(sizeof(char) * (len + 1));
while (i < len) {
*(ans++) = s[(n + i++) % len];
}
*ans = ‘
原创
2020-05-11 18:41:57 ·
80 阅读 ·
0 评论