<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ku-ma-me</author_name>
  <author_url>https://blog.hatena.ne.jp/ku-ma-me/</author_url>
  <blog_title>まめめも</blog_title>
  <blog_url>https://mametter.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
  </categories>
  <description>リスト中に登場する回数の多い要素トップ N を計算するとき、どんな風に書きますか？ 順序統計量の話がしたいわけではなく、そういうコードは頻繁に書くわりに、書き方に納得できなくていつも悩んでいるのです。短く、かつ、わかりやすい書き方がポイント高いです (効率は軽視) 。普段は以下のように書いているけど、これは長すぎかつ難解で納得できてません。 ary = %w(foo bar foo baz foo bar qux foo bar qux quux) n = 3 # 回数をカウントする count = Hash.new { 0 } ary.each {|x| count[x] += 1 } # …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmametter.hatenablog.com%2Fentry%2F20070614%2Fp2&quot; title=&quot; ランキングの集計 - まめめも&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2007-06-14 00:00:01</published>
  <title> ランキングの集計</title>
  <type>rich</type>
  <url>https://mametter.hatenablog.com/entry/20070614/p2</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
