-
Notifications
You must be signed in to change notification settings - Fork 49
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
Daniela Sanchez - Leaves #45
base: master
Are you sure you want to change the base?
Conversation
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.
Daniela, can you leave your 1st name and class in the PR title.
Your 1st method works, see my note at the end. It's almost perfect except for that one thing. The 2nd method has an infinite loop
end | ||
|
||
current = 0 | ||
until array_characters.length - 1 < current |
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 should also repeat until same
is false.
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: n, as my algorithm needs to iterate through all elements. | ||
# Space Complexity: n, as I'm creating an array to store the characters in each iteration. More elements, longer the new array. | ||
def longest_prefix(strings) |
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're getting stuck in an infinite loop here.
end | ||
|
||
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: n, as my algorithm needs to iterate through all elements. |
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 would say it's O(n) if the strings are small and O(m * n) where m is the length of the longest string if they're not.
Finished, but by some reason the tests stopped working. I had same issue last time with the last project for CS Fundamentals. I couldn't verify if the second exercise passed all tests. :(