Skip to content

Leaves- Natalie Tapias#23

Open
NatalieTapias wants to merge 3 commits into
Ada-C12:masterfrom
NatalieTapias:master
Open

Leaves- Natalie Tapias#23
NatalieTapias wants to merge 3 commits into
Ada-C12:masterfrom
NatalieTapias:master

Conversation

@NatalieTapias

Copy link
Copy Markdown

No description provided.

@CheezItMan CheezItMan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first method works well, nice work. See my note on the time complexity. For the other I left a note about where I think you started to get off track.

Overall, not bad!

Comment thread lib/practice_exercises.rb
@@ -1,13 +1,45 @@
require "pry"
# Time Complexity: ? O(n) where n corresponds with the length of input array

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since delete_at shifts all subsequent elements over one index, the time complexity of delete_at is O(n) and so your method is O(n2).

Comment thread lib/practice_exercises.rb

strings.each_with_index do |string, i|

return a if string[i][j] != collection_of_letters

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean string[j] != collection_of_letters[j] here

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

Successfully merging this pull request may close these issues.

2 participants