Skip to content

Odd occurences in array#1

Merged
wozane merged 3 commits intomasterfrom
odd_occurences_in_array
Jun 30, 2017
Merged

Odd occurences in array#1
wozane merged 3 commits intomasterfrom
odd_occurences_in_array

Conversation

@wozane
Copy link
Copy Markdown
Owner

@wozane wozane commented Jun 26, 2017

No description provided.

Copy link
Copy Markdown

@esse esse left a comment

Choose a reason for hiding this comment

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

style changes

@@ -0,0 +1,8 @@
def solution(array)
numbers = Hash.new(0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

is it really needed here?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

not really :)

@@ -0,0 +1,8 @@
def solution(array)
numbers = Hash.new(0)
odd_numbers = Hash.new(0)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

same question as before

Copy link
Copy Markdown
Owner Author

@wozane wozane Jun 27, 2017

Choose a reason for hiding this comment

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

👍

numbers = Hash.new(0)
odd_numbers = Hash.new(0)

numbers = array.group_by { |num| num }
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

you can write it prettier: numbers = array.group_by(&:itself)

@wozane wozane merged commit ecfd36a into master Jun 30, 2017
@wozane wozane deleted the odd_occurences_in_array branch June 30, 2017 09:21
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