-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Leetcode solutions #349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leetcode solutions #349
Conversation
|
Hi @shubhamdpatil , someone already resolved problems 7 and 8. Could you add your solution when you see your way is a different solution? I can merge when you resolve the conflict. Thank you |
| @@ -0,0 +1,37 @@ | |||
| int strStr(char* haystack, char* needle) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your way is brutal force. Do you come up with more efficient solution? It is a typical problem for pattern search. For example: Rabin Karp, KMP, or Horspool, ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have implemented this a year ago and I do not want to blindly implement an algorithm, so I'll need some time for that. It is up to you, you can merge this PR and I'll raise another one with the optimised solution to this problem or keep it open till I come up with another approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I raise a new pull request or add the kmp implementation to this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, if you have the chance
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I could not see my commits in mater branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can create a new one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I'll create a new PR qwith all the previous and will add KMP to it.
Leetcode solutions for
2. Add Two Numbers
4. Median of Two Sorted Arrays
7. Reverse Integer
8. String to Integer (atoi)
21. Merge Two Sorted Lists
28. Implement strStr()
#249