Skip to content

Instantly share code, notes, and snippets.

@douglas-vaz
Created July 23, 2014 07:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglas-vaz/9917138cb70169f645ec to your computer and use it in GitHub Desktop.
Save douglas-vaz/9917138cb70169f645ec to your computer and use it in GitHub Desktop.
Bruteforce substring check
isSubstring(String A, String B) {
    for i = 0 to len(A)-len(B) {
        j = 0;
        while j < len(B) and A[i+j] == B[j] {
            j = j + 1;
        }
        if j == len(B) {
            return True;
        }
    }
    return False;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment