public class Solution
{
public bool RotateString(string A, string B)
{
string temp = A;
int len = A.Length;
int lenB = B.Length;
if (len != lenB)
{
return false;
} if (len == )
{
return true;
}
for (int i = ; i < len; i++)
{
var prefix = A.Substring(, i);
var next = A.Substring(i);
if (B.Equals(next + prefix))
{
return true;
}
}
return false;
}
}

leetcode796的更多相关文章

  1. [Swift]LeetCode796. 旋转字符串 | Rotate String

    We are given two strings, A and B. A shift on A consists of taking string A and moving the leftmost ...

  2. Leetcode796.Rotate String旋转字符串

    给定两个字符串, A 和 B. A 的旋转操作就是将 A 最左边的字符移动到最右边. 例如, 若 A = 'abcde',在移动一次之后结果就是'bcdea' .如果在若干次旋转操作之后,A 能变成B ...

随机推荐

  1. opencv:图像模糊处理

    接口: blur(sourceImage,dstImage,Size(,)); // 图像模糊处理 示例代码: #include <opencv.hpp> #include <img ...

  2. xhtml html

    xhtml是用xml语言重写了html,相比html更规范了, XHTML是HTML像XML的一个过渡语言,它比HTML严谨性会高点,然后基本语言都还是沿用的HTML的标签,只不过废除了部分表现层的标 ...

  3. java学习网站推荐

    推荐大家一个好的java学习网站: http://www.programcreek.com/java-api-examples/index.php 可以找到api对应的开源项目使用的代码.

  4. I.MX6 support eMMC 5.0

    /***************************************************************************** * I.MX6 support eMMC ...

  5. [QT][待解决问题]对话框ui载入卡顿问题

    电脑运行环境:win7 + qt-opensource-windows-x86-mingw530-5.8.0源码是 < Qt快速入门系列教程目录 > 第3篇 Qt5基础(三)Qt登录对话框 ...

  6. The last packet sent successfully to the server was 0 milliseconds ago

    出现异常”The last packet sent successfully to the server was 0 milliseconds ago.“的大部分原因是由于数据库回收了连接,而系统的缓 ...

  7. c++ 遍历任务栏窗口

    // ConsoleApplication1.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <Windows.h& ...

  8. 11.7noip模拟赛

     题解:广义斐波那契数列 矩阵乘法 #include<iostream> #include<cstdio> #include<cstring> #define LL ...

  9. 洛谷 P3144 [USACO16OPEN]关闭农场Closing the Farm_Silver

    传送门 题目大意: n个谷仓 ,每次关闭一个谷仓,问剩下没被关闭的谷仓是 否联通. 题解:并查集+倒序处理 代码: #include<iostream> #include<cstdi ...

  10. webpack新版本4.12应用九(配置文件之使用不同语言进行配置)

    使用不同语言进行配置(configuration languages) 查看原文|编辑此页 webpack 接受以多种编程和数据语言编写的配置文件.支持的文件扩展名列表,可以在 node-interp ...