{"width":"100%","author_name":"peryaudo","url":"https://peryaudo.hatenablog.com/entry/2016/04/26/133122","provider_url":"https://hatena.blog","blog_title":"\u30da\u30ea\u30e3\u30a6\u30c9\u306e\u65e5","height":"190","blog_url":"https://peryaudo.hatenablog.com/","version":"1.0","description":"vector<int> Build(const string& s) { vector<int> fail(s.size() + 1); int j = -1; fail[0] = -1; for (int i = 0; i < s.size(); ++i) { while (j >= 0 && s[i] != s[j]) j = fail[j]; ++j; fail[i + 1] = j; } return fail; } void Match(const string& needle, const string& haystack, vector<int> *matches) { cons\u2026","title":"\u3088\u304f\u308f\u304b\u308bKMP","provider_name":"Hatena Blog","categories":[],"author_url":"https://blog.hatena.ne.jp/peryaudo/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fperyaudo.hatenablog.com%2Fentry%2F2016%2F04%2F26%2F133122\" title=\"\u3088\u304f\u308f\u304b\u308bKMP - \u30da\u30ea\u30e3\u30a6\u30c9\u306e\u65e5\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"published":"2016-04-26 13:31:22","type":"rich"}