{"id":37103889,"url":"https://github.com/cnnrrss/peter-piper","last_synced_at":"2026-01-14T12:34:16.000Z","repository":{"id":57599378,"uuid":"204263141","full_name":"cnnrrss/peter-piper","owner":"cnnrrss","description":"Peter told me that peter the pickle piper piped a pitted pickle before he petered out. Phew!","archived":false,"fork":false,"pushed_at":"2019-08-25T08:06:20.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T14:20:21.345Z","etag":null,"topics":["kmp-algorithm","knuth-morris-pratt","string-matching"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cnnrrss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-25T07:48:49.000Z","updated_at":"2019-08-25T08:06:37.000Z","dependencies_parsed_at":"2022-08-28T18:31:04.693Z","dependency_job_id":null,"html_url":"https://github.com/cnnrrss/peter-piper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cnnrrss/peter-piper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnnrrss%2Fpeter-piper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnnrrss%2Fpeter-piper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnnrrss%2Fpeter-piper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnnrrss%2Fpeter-piper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cnnrrss","download_url":"https://codeload.github.com/cnnrrss/peter-piper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cnnrrss%2Fpeter-piper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28420810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kmp-algorithm","knuth-morris-pratt","string-matching"],"created_at":"2026-01-14T12:34:15.330Z","updated_at":"2026-01-14T12:34:15.994Z","avatar_url":"https://github.com/cnnrrss.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/cnnrrss/peter-piper)](https://goreportcard.com/report/github.com/cnnrrss/peter-piper)\n[![GoDoc](https://godoc.org/github.com/cnnrrss/peter-piper?status.svg)](https://godoc.org/github.com/cnnrrss/peter-piper)\n\n\n# Peter Piper\n\nImplement the Knuth-Morris-Prat string matching algorithm in Go to complete the match subtext to a body of text.\n\n### Installation\n\n##### Install package\n`go get -u github.com/cnnrrss/peter-piper`\n\n##### Verify test cases pass\n`go test`\n**or** for verbose output..\n`go test -v`\n\n##### Verify all code is covered\n`go test -cover`\n\n### Implementation\nThe easiest way to solve this task would probably be some combination of the features from Go standard packages such as `strings` or `regexp`, but I assumed that was not the intent of the exercise.\n\nTherefore I thought about the available string matching algorithms to choose from: **Robin-Karp**, **Knuth-Morris-Pratt**, and **Boyer-Moore**. I chose to implement a modified version of the **Knuth-Morris-Pratt** because it provides a Time Complexity of **O(n + k)** and was easier to implement in the 1 - 2 hr activity window. Another potential solution would have been to implement a **Trie** / **Radix Tree** data structure.\n\n#### Dependencies\nAlthough I did not import any external packages to complete the task, I did rely on the **strings** package to update the input text to lowercase, satisfying the case insensitive requirement. I also imported the **reflect** and **testing** std packages to facilitate the test cases.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnnrrss%2Fpeter-piper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcnnrrss%2Fpeter-piper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcnnrrss%2Fpeter-piper/lists"}