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

Space - Diana #32

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Space - Diana #32

wants to merge 5 commits into from

Conversation

dnguye2
Copy link

@dnguye2 dnguye2 commented Mar 30, 2020

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Good work, you hit most of all the learning goals here. Well done.

Take a look at my comments and let me know if you have any questions.

Comment on lines +9 to +13
intersection_array = list2.map do |num|
num if lookup_hash[num]
end

return intersection_array.compact

Choose a reason for hiding this comment

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

Use map if you want to do an operation on each element in the array. In this case you want to get only some of the elements of the array.

Suggested change
intersection_array = list2.map do |num|
num if lookup_hash[num]
end
return intersection_array.compact
intersection_array = list2.select do |num|
lookup_hash[num]
end
return intersection_array

@@ -1,3 +1,25 @@
def intersection(list1, list2)

Choose a reason for hiding this comment

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

👍

Comment on lines +19 to +23
if number_of_odd > 1
return false
else
return true
end

Choose a reason for hiding this comment

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

Suggested change
if number_of_odd > 1
return false
else
return true
end
return number_of_odd > 1

@@ -1,4 +1,21 @@

def permutations?(string1, string2)

Choose a reason for hiding this comment

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

This would fail for something like heelo and hello. Instead of making lookup_hash[letter] = true instead count the number of times each letter appears.

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