One of These is Not Like the Others

Submitted By:
david

Difficulty:
Medium

Tags:
arrays, classes

Instructions:
One of these is not like the others. Write a method that will return the one that doesn't match.

Code:
___

assert_equal nonmatching([1, 2, 3, 4.0, 5, 6]), 4.0
assert_equal nonmatching(["ichi", "visitor q", 13, "assassins"]), 13
assert_equal nonmatching([/2001/, "full metal jacket", /paths of glory/]), "full metal jacket"  
assert_equal nonmatching([true, false, nil, (1==1)]), nil

Your Solution

Ruby 1.9.3

Back to Problems