diff options
Diffstat (limited to 'challenge-250/deadmarshal/ruby/ch1.rb')
| -rw-r--r-- | challenge-250/deadmarshal/ruby/ch1.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/challenge-250/deadmarshal/ruby/ch1.rb b/challenge-250/deadmarshal/ruby/ch1.rb new file mode 100644 index 0000000000..d21552eb85 --- /dev/null +++ b/challenge-250/deadmarshal/ruby/ch1.rb @@ -0,0 +1,11 @@ +#!/usr/bin/env ruby + +def smallest_index(arr) + (0..arr.length).map {|i| return i if i % 10 == arr[i]} + -1 +end + +p smallest_index([0,1,2]) +p smallest_index([4,3,2,1]) +p smallest_index([1,2,3,4,5,6,7,8,9,0]) + |
