MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / zAlgorithm

Function zAlgorithm

CPP/String/Z-Algorithm.cpp:30–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28}
29
30int zAlgorithm(string s, string p, int n, int m)
31{
32 // Write your code here
33 string str = p + "$" + s;
34 int len = str.size();
35 vector<int> arr(len,0);
36 solve(str,len,arr);
37 int c = 0;
38 for(int i = 0;i < len;i++){
39 if(arr[i] >= p.size()){
40 c++;
41 }
42 }
43 return c;
44}

Callers

nothing calls this directly

Calls 2

solveFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected