Beta

Rotated string

191 of 368pinelopi

Description:

Write to function that takes as argument two strings and returns positive (True/true/1) if one string is a rotation of the other or else it returns False/false/0.

For example:

# ohell is left rotation of hello
is_rotation('hello','ohell') => True

# elloh is right rotation of hello 
is_rotation('hello','elloh') => True
// ohell is left rotation of hello
isRotation('hello','ohell') => true

// elloh is right rotation of hello 
isRotation('hello','elloh') => true

// elolh is NOT a rotation of hello 
isRotation('hello','elolh') => false
// ohell is left rotation of hello
isRotation("hello","ohell") => true

// elloh is right rotation of hello 
isRotation("hello","elloh") => true

// elolh is NOT a rotation of hello 
isRotation("hello","elolh") => false
Algorithms
Strings

More By Author:

Check out these other kata created by pinelopi

Stats:

CreatedMay 3, 2015
PublishedMay 3, 2015
Warriors Trained675
Total Skips30
Total Code Submissions3071
Total Times Completed368
Python Completions191
JavaScript Completions138
Java Completions62
Total Stars16
% of votes with a positive feedback rating86% of 209
Total "Very Satisfied" Votes160
Total "Somewhat Satisfied" Votes38
Total "Not Satisfied" Votes11
Total Rank Assessments203
Average Assessed Rank
7 kyu
Highest Assessed Rank
2 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • pinelopi Avatar
  • jhoffner Avatar
  • ZozoFouchtra Avatar
  • WWW21 Avatar
  • cliffstamp Avatar
  • glovastefan Avatar
Ad