AlgoMaster Logo

Z-Algorithm

text=aabxaab,pattern=aab
0 / 31
concat = pattern + "$" + textZ[ ]012345678910aab$aabxaab-0000000000012345678910pattern (len=3)
algomaster.io
Step:Z-Algorithm: Build Z-array on "aab$aabxaab" (pattern + '$' + text), then find matches.