-
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
Branches - Linnea #49
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.
Thanks for getting this in. Take a look at my comments and let me know if you have any questions. Some things to work on here.
if list[i] != i | ||
new_list << list[i] | ||
end |
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.
This is only not adding elements if they are not equal to their index, which won't work in all cases.
Consider:
it "will remove duplicates for even longer arrays " do
expect(remove_duplicates([1, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 4, 4, 4])).must_equal [1, 2, 3, 4]
end
end | ||
|
||
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n^2) |
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.
This is actually O(nm) where m is the length of the shortest word.
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n^2) | ||
# Space Complexity: O(n) |
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.
Given the above space complexity is O(m)
No description provided.