Ruby Language Public



Implement a group_by_owners function that:

  • Accepts a hash containing the file owner name for each file name.
  • Returns a hash containing an array of file names for each owner name, in any order.

For example, for hash {'Input.txt' => 'Randy', '' => 'Stan', 'Output.txt' => 'Randy'} the group_by_owners function should return {'Randy' => ['Input.txt', 'Output.txt'], 'Stan' => ['']}.

Ruby 2.2.2

  •   Example case: Wrong answer
  •   Each owner has a single file: Wrong answer
  •   Various files: Wrong answer