This comment is hidden because it contains spoiler information about the solution
Great solution, but \w would match digits and underscore. Per description "word" is a sequence of alphabetical characters.
Prime numbers are natural numbers greater than 1 (kata's description even mentions that), so there's no need to check divisors of negative numbers, just return false.
Loved your solution!
Other upvoted solutions are slow as hell and yours is even faster than mine.
Kudos!
Only problem for me is that method .delete_if mutates the caller. Value of "order" was changed. Method .reject would suit me be better in this case.
Nevertheless great solution!
It's an offset. It sets starting value of the index (default is 0).
https://ruby-doc.org/core-2.4.1/Enumerator.html#method-i-with_index
Clever solution! Though if you'd use single quotes in a gsub/sub, you wouldn't have to escape first reference twice, just once.
yes.
The code is legable and as a result maintainable.
Great kata!
Though, I'd change method name in Ruby translation to snake case.
Loading collection data...
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Great solution, but \w would match digits and underscore. Per description "word" is a sequence of alphabetical characters.
Prime numbers are natural numbers greater than 1 (kata's description even mentions that), so there's no need to check divisors of negative numbers, just return false.
This comment is hidden because it contains spoiler information about the solution
Loved your solution!
Other upvoted solutions are slow as hell and yours is even faster than mine.
Kudos!
Only problem for me is that method .delete_if mutates the caller.
Value of "order" was changed. Method .reject would suit me be better in this case.
Nevertheless great solution!
This comment is hidden because it contains spoiler information about the solution
It's an offset. It sets starting value of the index (default is 0).
https://ruby-doc.org/core-2.4.1/Enumerator.html#method-i-with_index
Clever solution!
Though if you'd use single quotes in a gsub/sub, you wouldn't have to escape first reference twice, just once.
yes.
This comment is hidden because it contains spoiler information about the solution
The code is legable and as a result maintainable.
This comment is hidden because it contains spoiler information about the solution
Great kata!
Though, I'd change method name in Ruby translation to snake case.
Loading more items...