leetcode796
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的更多相关文章
- [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 ...
- Leetcode796.Rotate String旋转字符串
给定两个字符串, A 和 B. A 的旋转操作就是将 A 最左边的字符移动到最右边. 例如, 若 A = 'abcde',在移动一次之后结果就是'bcdea' .如果在若干次旋转操作之后,A 能变成B ...
随机推荐
- jsp转发和重定向
response应答 a) Response.sendRedirect(路径); //重定向 b) Response.getRequestDispatcher(路径).forward(request, ...
- QWidget类参考
QWidget类是所有用户界面对象的基类. 详情请见…… #include <qwidget.h> 继承QObject和QPaintDevice. 被QButton.QFrame.QDia ...
- android安装apk
* 安装apk */ private void installApk() { // 获取当前sdcard存储路径 File apkfile = new File(Environment.getE ...
- lzugis——Arcgis Server for JavaScript API之自定义InfoWindow(续)
同样的标题后面加了一个括弧,不是为了增减博文数量,而确实是上个功能的完善,标注为续,意思是继续上次的内容,来说说如何自定义InfoWindow. 在上一讲中,实现了InfoWindow的显示,但是并没 ...
- Android 进阶16:IntentService 使用及源码解析
It's time to start living the life you've only imagined. 读完本文你将了解: IntentService 简介 IntentService 源码 ...
- B. Clique Problem(贪心)
题目链接: B. Clique Problem time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- Vagrant 常用命令
Vagrant 常用命令 首先需要创建一个目录用于存放Vagrantfile文件以及Vagrant在工作中的数据: mkdir my-vagrant-project cd my-vagrant-pro ...
- leetcode_sql_4,196
196. Delete Duplicate Emails Write a SQL query to delete all duplicate email entries in a table name ...
- phpwind主要表结构的研究随笔[1]
最近计划做一个新闻网站,前端打算用成熟的CMS搭建,后台是mongodb+mysql做数据过滤容器和最终数据存储,选型CMS如下: dedecms:国内某知名cms,以前用过,功能强大,网上资料资料很 ...
- 【转】数据库范式(1NF 2NF 3NF BCNF)
范式判断流程图 1. 四种范式之间关系 2.第二范式.第三范式.BCNF区别: 2NF:非主键列和主键列之间,是完全依赖于主键,还是依赖于主键的一部分(只依赖某个主键): 3NF:非主键列之间,不存在 ...