Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Would fail if
event
contains stuff like%d
.woow, thanks alot i didnt even know this.
This comment is hidden because it contains spoiler information about the solution
have replaced the
occurrences = Hash.new(0)
withoccurrences = {}
.It throws an error and i dont understand why, who can explain the reason?This comment is hidden because it contains spoiler information about the solution
I'm a newbie in Ruby and managed to answer this coding problem using a different solution. I just want to understand how the above answer is possible if anyone can explain please?
It's correct to say that the problem does not require
five_num
to check for invalid input.This approach changes the interface of Array, adding a new method that throws a
NoMethodError
when the Array instance doesn't conform to a special use case. As a result, any subsequent instance of Array can respond to a method that may be meaningless (and unsafe) for that instance.Why change the interface of Array?
Or to put it another way, would this also be a good solution? Why or why not?
Then it won't work, but the instructions say:
Create a five_num method that takes an array of integers as an argument
so checking for invalid input is not a requirement.
What if an instance of Array contains non-Numeric values?
teach us gsub!
Not good
what does partition do
This is the fastest and best solution.
poetic
Just one small nit.
size
is preferred overlenght
https://rubystyle.guide/#map-find-select-reduce-include-size
Loading more items...