Skip to content
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

Longest common substring wrongly coded. #272

Open
To-heeb opened this issue Sep 27, 2023 · 0 comments
Open

Longest common substring wrongly coded. #272

To-heeb opened this issue Sep 27, 2023 · 0 comments

Comments

@To-heeb
Copy link

To-heeb commented Sep 27, 2023

The longest common substring is wrongly in Python coded and throws an error anytime it runs, this should be prioritized since it is a core part of the book.

dp_table_blue = ["b", "l", "u", "e"]
dp_table_clues = ["c", "l", "u", "e", "s"]
dp_table = [[0 for i in range(len(dp_table_blue))] for i in range(len(dp_table_clues))] # (5,4)
print(dp_table)

for i in range(0, len(dp_table_blue)):
    for j in range(0, len(dp_table_clues)):
        if dp_table_clues[j] == dp_table_blue[i]:
            dp_table[i][j] = dp_table[i-1][i-1] + 1

print(dp_table)

copy this code and try to run it here https://onecompiler.com/python or click this link https://onecompiler.com/python/3znsmgdbr to run it directly to get the errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant