Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

233
Views
rieles Grupo Cadenas dentro de Cadena

Tengo una matriz que se ve así

 a = ["red apple juice", "red mango juice", "red berry juice" "red fish juice", black berry juice, black potato juice, yellow bananen juice, yellow ananas juice, yellow onion juice,

y me gustaria tener

 {red => 4, black => 2, yellow => 3}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Use Enumerable#tally :

 a = [ "red apple juice", "red mango juice", "red berry juice", "red fish juice", "black berry juice", "black potato juice", "yellow bananen juice", "yellow ananas juice", "yellow onion juice" ] a.map {|s| s.split.first.to_sym }.tally # => {:red=>3, :black=>2, :yellow=>3}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!