Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions solution.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,24 @@ Solution = (function() {
return {
isRotation: function(str1, str2) {
//your solution goes here
throw 'missing implementation';
}
if (str1.length != str2.length)
return false

var rotatedStr = str1
for (i = 0; i < str1.length; i++) {
if (rotatedStr == str2)
return true

rotatedStr = rotateLeft(rotatedStr)

}

return false
}

rotateLeft: function(str) {
var firstChar = str.charAt(0)
return str.substring(1) + firstChar
}
}
}());
}());