Beta

Social Golfer Problem Validator V2

Description:

A group of N golfers wants to play in groups of G players for D days in such a way that each golfer plays exactly once with all other golfers

Sun    ABC    DEF    GHI    JKL    MNO
Mon    ADH    BEK    CIO    FLN    GJM
Tue    AEM    BHN    CGK    DIL    FJO
Wed    AFI    BLO    CHJ    DKM    EGN
Thu    AGL    BDJ    CFM    EHO    IKN
Fri    AJN    BIM    CEL    DOG    FHK
Sat    AKO    BFG    CDN    EIJ    HLM

Write a function that validates a proposed solution, a list of list of strings, as being a solution to the social golfer problem. Each character represents a golfer, and each string is a group of players. Rows represent days. The solution above would be encoded as:

[
  ['ABC', 'DEF', 'GHI', 'JKL', 'MNO'],
  ['ADH', 'BEK', 'CIO', 'FLN', 'GJM'],
  ['AEM', 'BHN', 'CGK', 'DIL', 'FJO'],
  ['AFI', 'BLO', 'CHJ', 'DKM', 'EGN'],
  ['AGL', 'BDJ', 'CFM', 'EHO', 'IKN'],
  ['AJN', 'BIM', 'CEL', 'DOG', 'FHK'],
  ['AKO', 'BFG', 'CDN', 'EIJ', 'HLM']
]

You need to make sure (1) that each golfer plays exactly once every day, (2) that the number and size of the groups is the same every day, and (3) that each player plays with every other player exactly once.

It is not necessary to consider the case where the number of golfers is zero

All credits to rtoal for creating this kata, with his permission I just edited to add additional constraint. See original here: https://www.codewars.com/kata/social-golfer-problem-validator/

Fundamentals
Algorithms

Stats:

CreatedApr 23, 2018
PublishedApr 23, 2018
Warriors Trained68
Total Skips1
Total Code Submissions141
Total Times Completed23
Python Completions23
Total Stars2
% of votes with a positive feedback rating96% of 12
Total "Very Satisfied" Votes11
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes0
Total Rank Assessments11
Average Assessed Rank
6 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
6 kyu
Ad
Contributors
  • JonWoodlief Avatar
Ad