Created
May 12, 2016 11:24
-
-
Save roylee0704/0c18d1a95c1e96207283bcb729955424 to your computer and use it in GitHub Desktop.
substring implemented naively.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func naive_substr(s, t string) bool { | |
if len(s) > len(t) { | |
return false | |
} | |
for i := 0; i < len(t)-len(s); i++ { | |
if !compare(s, t[i:len(s)+i]) { | |
return false | |
} | |
} | |
return true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment