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. 33-THREE.JS 圆柱体

    <!DOCTYPE html> <html> <head> <title></title> <script src="htt ...

  2. Hibernate中Hql查询

    这篇随笔将会记录hql的常用的查询语句,为日后查看提供便利. 在这里通过定义了三个类,Special.Classroom.Student来做测试,Special与Classroom是一对多,Class ...

  3. LeetCode OJ:Combination Sum II (组合之和 II)

    Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in ...

  4. 理解RESTful风格(转)

    原文链接:http://www.ruanyifeng.com/blog/2011/09/restful.html 越来越多的人开始意识到,网站即软件,而且是一种新型的软件. 这种"互联网软件 ...

  5. 【SQL查询】视图_view

    转自:http://database.e800.com.cn/articles/2009/719/1248015564465_1.html 视图是从一个或几个基本表(或视图)导出的表.它与基本表不同, ...

  6. Http权威指南(概述篇总结)

    之前的<锋利的jQuery>后面陆续翻完了,实在觉得没什么值得记录的,也就没继续写了,然后看见书架上有 本去年买的<Http权威指南>,其实做web编程的,对于Http协议还是 ...

  7. freemarker 常见问题

    <#setting date_format="yyyy-MM-dd"> ..设置时间格式然后获取从后台获取值${s.createTime?date}这样就能正常显示了 ...

  8. python 使用sk_learn 遇到 问题ValueError: Expected 2D array, got 1D array instead:

    这里我找到我的问题是: 使用的是一个新的scikit学习版本,它抛出了一个错误,因为在新版本中,所有东西都必须是一个二维矩阵,甚至是一个列或行. 它甚至说:用数组来重塑你的数据.如果您的数据有一个单独 ...

  9. LeetCode Replace Words

    原题链接在这里:https://leetcode.com/problems/replace-words/description/ 题目: In English, we have a concept c ...

  10. fn project 试用之后的几个问题

    今天试用fnproject  之后自己有些思考,后面继续解决   1. 目前测试是强依赖 dockerhub 的,实际可能不是很方便 2. 如何与k8s .mesos.docker swarm  集成 ...