Tuesday 12 July 2016

Select Map

Difficulty:
Easy

Tags:
enumerables, procs

Instructions:
The Pattern object not only functions as a Regexp. For example, check out what happens if you do Pattern === element. This problem demonstrates that using a Pattern with #grep will work much like using select and map in combination.

Problem and Solution:

Pack Template UTF-8

Difficulty:
Easy

Tags:
pack

Instructions:
Write pack template of UTF-8.

Problem and Solution:

Simple String Substitution

Difficulty:
Easy

Tags:
strings

Instructions:
One of the challenges in implementing Rubeque is performing string substitution. See how well you can do.

Problem and Solution:

Quelle Heure Est-Il?

Difficulty:
Easy

Tags:
dates, strings

Instructions:
Write a function to parse some dates and return a standard format. Hint: the help page might be of use.

Problem and Solution:

Implement a Hash With Indifferent Access

Difficulty:
Easy

Tags:
hashes, classes

Instructions:
Implement a hash class which does not distinguish between symbols and strings for its keys.

Problem and Solution:

Unidentified X Object

Difficulty:
Easy

Tags:
strings, operators

Instructions:
Use comparison operators.

Problem and Solution:

Join URL params

Difficulty:
Easy

Tags:
url, params

Instructions:
Join parameters to a link.

Problem and Solution:

The Gray Area

Difficulty:
Easy

Tags:
booleans

Instructions:
Write code that will make true equal false in the following problem.

Problem and Solution:

Implement Array#interleave

Difficulty:
Easy

Tags:
arrays

Instructions:
Implement an Array method to interleave an array with a dynamic number of arguments or an array.

Problem and Solution:

Counting Elements in Array

Difficulty:
Easy

Tags:
arrays

Instructions:
Count elements in an Array by returning a hash with keys of the elements and values of the amount of times they occur.

Hidden Code:
There is hidden code with assertions that is also being run to test out your code.

Problem and Solution:

Architecting a Solution

Difficulty:
Easy

Tags:
structs, classes

Instructions:
Use a Struct to define an Architect class.

Hidden Code:
There is hidden code with assertions that is also being run to test out your code.

Problem and Solution:

A Man, A Plan, A Canal--Panama!

Difficulty:
Easy

Tags:
strings

Instructions:
A palindrome is a string that is written the same forward as it is in reverse. Write a method to return the longest palindrome in a given string

Problem and Solution:

Defusing a Bomb

Difficulty:
Easy

Tags:
nil, exceptions

Instructions:
Prevent the following code from throwing an expection

Problem and Solution:

Related keys of Hash

Difficulty:
Easy

Tags:
hashes

Instructions:
Get keys of a hash whose values equal to given arguments.

Problem and Solution:

Fixing Bad Code the Wrong Way

Difficulty:
Easy

Tags:
method_missing, classes

Instructions:
Your coworker did a bad job defining a class. Fix it for him using #method_missing.

Problem and Solution:

Random Boolean

Difficulty:
Easy

Tags:
rand, booleans

Instructions:
Return random booleans

Problem and Solution:

Separating Numbers with Commas

Difficulty:
Easy

Tags:
strings, regular expressions

Instructions:
Separate numbers with a comma each three digits.

Problem and Solution:

The Lambda Lambda Lambda Fraternity

Difficulty:
Easy

Tags:
lambdas, procs, ruby 1.9

Instructions:
Write a proc or lambda that'll take one or two numbers and return true if one or both numbers are even.

Problem and Solution:

Each With Object

Difficulty:
Easy

Tags:
ruby 1.9, enumerables

Instructions:
ne of our favorite methods in Ruby 1.9 is each_with_object. It works much like inject. Use each_with_object to return an array containing one reversed string for each string that has an even number of characters.

Problem and Solution: