add min insertions & deletions example#3694
add min insertions & deletions example#3694ankit-bagde wants to merge 2 commits intoTheAlgorithms:masterfrom ankit-bagde:master
Conversation
ghost
left a comment
There was a problem hiding this comment.
These are few changes (enhancements). Also please fix your error of trailing whitespaces using a code formatter like black. You can read CONTRIBUTING.md for instructions to use black.
| """ | ||
|
|
||
|
|
||
| def longest_common_subsequence(str1: str, str2: str): |
There was a problem hiding this comment.
| def longest_common_subsequence(str1: str, str2: str): | |
| def longest_common_subsequence(str1: str, str2: str) -> int: |
add type hinting for return value
| >>> min_insertions_deletions(32, "app") | ||
| Traceback (most recent call last): | ||
| File "min_insertions_deletions.py", line 96, in <module> | ||
| insertions, deletions = min_insertions_deletions(str1, str2) | ||
| File "min_insertions_deletions.py", line 78, in min_insertions_deletions | ||
| assert type(str1) is str, "str1 should be a string, not {}".format(type(str1)) | ||
| AssertionError: str1 should be a string, not <class 'int'> |
There was a problem hiding this comment.
| >>> min_insertions_deletions(32, "app") | |
| Traceback (most recent call last): | |
| File "min_insertions_deletions.py", line 96, in <module> | |
| insertions, deletions = min_insertions_deletions(str1, str2) | |
| File "min_insertions_deletions.py", line 78, in min_insertions_deletions | |
| assert type(str1) is str, "str1 should be a string, not {}".format(type(str1)) | |
| AssertionError: str1 should be a string, not <class 'int'> | |
| >>> min_insertions_deletions(32, "app") | |
| Traceback (most recent call last): | |
| ... | |
| AssertionError: str1 should be a string, not <class 'int'> |
details are not necessary in doctests
|
Thank you for the suggestions. I have committed the changes |
ghost
left a comment
There was a problem hiding this comment.
@dhruvmanila @poyea @Kush1101, check this out (ready to be merged)
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Please reopen this pull request once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions! |
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.