-
Notifications
You must be signed in to change notification settings - Fork 47
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
Time - Sharon Cheung #31
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.
Good work, you hit most of all the learning goals here. Well done.
Take a look at my comments regarding palindrome_permutations
and let me know if you have any questions.
@@ -1,4 +1,21 @@ | |||
|
|||
def palindrome_permutation?(string) |
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 doesn't seem to work.
letter_hash.each_value do |times| | ||
if times % 2 != 0 | ||
midpoint += 0 | ||
end | ||
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.
You would do better here to see how many letters appear an odd number of times.
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.
Sorry about that, Chris! I had a typo in my code. so it should be
midpoint += 1
instead of midpoint += 0
I run rake file after that seems to fix the failures, would that be consider working for this method? Just wondering. Thanks!
`def palindrome_permutation?(string)
letter_hash = {}
string.split("").each do |letter|
if letter_hash[letter] == nil
letter_hash[letter] = 1
else
letter_hash[letter] += 1
end
end
midpoint = 0
letter_hash.each_value do |times|
if times % 2 != 0
midpoint += 1
end
end
return midpoint <= 1
end
`
@@ -1,4 +1,28 @@ | |||
|
|||
def permutations?(string1, string2) |
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.
👍
No description provided.