You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In your PR description, you should tick whatever suits your PR but don't delete other checkboxes, also tick that checkbox for bug fixing or doc change which u deleted.
=================================== FAILURES ===================================
___________ [doctest] strings.knuth_morris_pratt.knuth_morris_pratt ____________
009 1) Preprocess pattern to identify any suffixes that are identical to prefixes
010 011 This tells us where to continue from if we get a mismatch between a character
012 in our pattern and the text.
013 014 2) Step through the text one character at a time and compare it to a character in
015 the pattern updating our location within the pattern if necessary
016 017 >>> kmp = "knuth_morris_pratt"
018 >>> knuth_morris_pratt(kmp, "kn") == kmp.find("kn")
Expected:
True
Got:
False
As discussed in CONTRIBUTING.md, you can run these on your own computer with: python3 -m doctest -v strings/knuth_morris_pratt.py
If we are going to be consistent with str.find() then we should change knuth_morris_pratt(sub, text) to knuth_morris_pratt(text, sub) to match the str.find() calling conventions and knuth_morris_pratt(text, sub) == text.find(sub) should always be True.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your change:
function kmp() now returns the first occurrence of the pattern. If the pattern does not exist in the given text, it returns -1
See #9077
Checklist: