I need to compare two string for eg : pattern = “mmcm” description = “mcmcmmmcmmcmmcm”;
which method is faster in terms of complexity lets say description 1 <= pattern.length <= description.length <= 10^6
Kmp(pattern,description)
contains(pattern,description)
indexof(pattern,description)
I need confuse if kmp is faster than contains then why we use contains ?
New contributor
user_052003 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.