aboutsummaryrefslogtreecommitdiff
path: root/challenge-250/deadmarshal/ruby/ch2.rb
blob: 409b548495744106d79eb18589cfef0ee37fb10a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env ruby

def alphanumeric_string_value(arr)
  max = 0
  arr.map do |e|
    n = (true if Integer(e) rescue false) ? e.to_i : e.length
    max = n if n > max
  end
  max
end

p alphanumeric_string_value(['perl','2','000','python','r4ku'])
p alphanumeric_string_value(['001','1','000','0001'])