You've successfully subscribed to The Poor Coder | Hackerrank Solutions
Great! Next, complete checkout for full access to The Poor Coder | Hackerrank Solutions
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Home
Author
Terms
Privacy
About
Tumblr
Pinterest
Enable dark mode
Enumerables
Beeze Aal
26.Aug.2020
Hackerrank Ruby - Enumerable - group_by Solution
Another function often used with data collections is one which groups the elements according to some evaluation result. Consider the following example. Let's say you have a list of 100 integers and you want to group them according to their even and odd value. In Ruby, you can easily do
Beeze Aal
26.Aug.2020
Hackerrank Ruby Enumerables: 'any', 'all', 'none', and 'find' Solution
Ruby offers various enumerables on collections that check for validity of the objects within it. Consider the following example:> arr = [1, 2, 3, 4, 5, 6]=> [1, 2, 3, 4, 5, 6]> h = {"a" => 1, "b" => 2, "c" => 3}=> {"a" => 1, "b"
Beeze Aal
26.Aug.2020
Hackerrank Ruby - Enumerable - reduce Solution
A common scenario that arises when using a collection of any sort, is to get perform a single type of operation with all the elements and collect the result. For example, a sum(array) function might wish to add all the elements passed as the array and return the result.
Beeze Aal
26.Aug.2020
Hackerrank Ruby - Enumerable - collect Solution
.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%} .MathJax_SVG .MJX-monospace {font-family: monospace} .MathJax_SVG .MJX-sans-serif {font-family: sans-serif} .MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent:
Beeze Aal
26.Aug.2020
Hackerrank Ruby - Enumerable - each_with_index Solution
In the previous challenge, we learned about each method being central to all of the methods provided by Enumerable class. One of such useful methods is each_with_index which allows you to iterate over items along with an index keeping count of the item. For example,> colors = ['red',
Beeze Aal
26.Aug.2020
Hackerrank Ruby - Enumerable - Introduction Solution
.MathJax_SVG_Display {text-align: center; margin: 1em 0em; position: relative; display: block!important; text-indent: 0; max-width: none; max-height: none; min-width: 0; min-height: 0; width: 100%} .MathJax_SVG .MJX-monospace {font-family: monospace} .MathJax_SVG .MJX-sans-serif {font-family: sans-serif} .MathJax_SVG {display: inline; font-style: normal; font-weight: normal; line-height: normal; font-size: 100%; font-size-adjust: none; text-indent: