diff --git a/koodi.rb b/koodi.rb index 932f2b3..7c0480c 100644 --- a/koodi.rb +++ b/koodi.rb @@ -1 +1,17 @@ # kirjoita koodi tänne +def esiintymat(a) + hash = {} + + a.each do |i| + + if hash.has_key? i + hash[i] = hash[i] + 1 + else + hash[i] = 1 + end + + end + + hash + +end \ No newline at end of file