My version of the answers to Problem Set 3. Please note that I might have diverted slightly of what might have been asked in the question. I adjusted my algorithm for those cases where close matches were being sought for single letter strings. Hope this helps
Problem Set 3 (Part I - Part IV)
Hi chribonn, I have a question regarding the function subStringMatchExact. In its second to last line, there's LastPos = str.find(target, key, LastPos + 1). Instead of the 3rd argument "LastPos+1", the argument "LastPos+len(key)" also works if I just use the function subStringMatchExact on its own. But if I call this function from some other function like subStringMatchOneSub, it takes forever to run. In that case, "LastPos+len(key)" doesn't work. Is there any explanation for why this happens? Thank you! btw your idea of using addUnique was really great. thanks again. :)
Join our real-time social learning platform and learn together with your friends!