MCPcopy Create free account
hub / github.com/careercup/ctci / isSubstring

Function isSubstring

python/Chapter 1/Question1_8/ChapQ1.8.py:5–6  ·  view source on GitHub ↗
(s1,s2)

Source from the content-addressed store, hash-verified

3#a rotation of s1 using only one call to isSubstring (e.g.,"waterbottle" is a rotation of "erbottlewat").
4
5def isSubstring(s1,s2):
6 return s1.find(s2) > -1
7
8def rotatedStringHasSubstring(s1,s2):
9 #doubling the string ensures a complete substring regardless of rotation

Callers 1

Calls 1

findMethod · 0.45

Tested by

no test coverage detected