"<small><i>This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://bit.ly/code-notes).</i></small>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Problem: Determine if a string s1 is a rotation of another string s2, by calling (only once) a function is_substring\n",
"\n",
"* [Constraints and Assumptions](#Constraints-and-Assumptions)\n",
"* [Test Cases](#Test-Cases)\n",
"* [Algorithm](#Algorithm)\n",
"* [Code](#Code)\n",
"* [Unit Test](#Unit-Test)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Constraints\n",
"\n",
"*Problem statements are often intentionally ambiguous. Identifying constraints and stating assumptions can help to ensure you code the intended solution.*\n",
"\n",
"* Can I assume the string is ASCII?\n",
" * Yes\n",
" * Note: Unicode strings could require special handling depending on your language\n",
"* Can you use additional data structures? \n",
" * Yes\n",
"* Is this case sensitive?\n",
" * Yes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Test Cases\n",
"\n",
"* Any strings that differ in size -> False\n",
"* None, 'foo' -> False (any None results in False)\n",
"*It is important to identify and run through general and edge cases from the [Test Cases](#Test-Cases) section by hand. You generally will not be asked to write a unit test like what is shown below.*\n",
"\n",
"**The following unit test is expected to fail until you solve the challenge.**"