target
are present in source
. If not, return -1
.sourcePointer
to 0 and targetPointer
to 0.count
to 1.targetPointer
is less than the length of target
:
a. If sourcePointer
is equal to the length of source
, reset it to 0 and increment count
.
b. If the character at sourcePointer
matches the character at targetPointer
, increment both pointers.
c. Otherwise, increment only sourcePointer
.target
are matched, return count
.