Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdds new dynamic programming algorithm #2275
Conversation
|
What is the use case for this algorithm? Where would we want to use it and why? |
TravisBuddy
commented
Aug 3, 2020
|
Hey @kishan151999, TravisCI finished with status TravisBuddy Request Identifier: b70aa2d0-d57c-11ea-8ca9-c37e1b84d109 |
|
|
I have fixed all the issues and committed the changes. Thank you for letting me know. |
| """ | ||
|
|
||
| # creating an array to store the values generated | ||
| dp_table = [[1 for i in range(length)] for i in range(length)] |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 3, 2020
Member
What would we call the value that is in each cell of this table? Are the weights or probabilities or angstroms or what?
| """ | ||
|
|
||
|
|
||
| def longest_palindromic_subsequence(s: str, length: int) -> int: |
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 3, 2020
Member
| def longest_palindromic_subsequence(s: str, length: int) -> int: | |
| def longest_palindromic_subsequence(s: str, length: int) -> str: |
We should return the sequence, not the length of the sequence. The function is not named length_of_the_longest_palindromic_subsequence() so I would not expect an int result.
The caller can always call len(result) if they want the length.
| >>> longest_palindromic_subsequence("ABACCG",6) | ||
| 3 | ||
| >>> longest_palindromic_subsequence("55055901565109",14) | ||
| 9 |
This comment has been minimized.
This comment has been minimized.
cclauss
Aug 3, 2020
Member
Please provide a negative test case that contains no palendrome. Also, a test case for the empty string.
kishan151999 commentedAug 3, 2020
•
edited
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.