MemberCheck APT

Class

public class MemberCheck { public String[] whosDishonest(String[] club1, String[] club2, String[] club3) { // TODO: fill in code here } }

Problem Statement

A health club chain allows its members to visit any of its many health club locations an unlimited number of times per day. The only constraining rule is, a customer can only visit one health club location per day, even though he or she may return to that location an unlimited number of times for the rest of that day.

Although the honor system has always worked quite well, the club wants to run some tests to see how many people really follow the rules. You are to write a program that takes the entrance log files from three different clubs (all logging the same day) and return a sorted list of the people who are not honest and went to more than one health club location in the same day.

The log files are represented as String[]'s where each element is the member name of a customer who entered that day. For example, if a customer showed up three times to one of the club locations that day, the member's name would appear three times in the corresponding String[].

Notes

Constraints

Examples

  1. {"JOHN","JOHN","FRED","PEG"}
    {"PEG","GEORGE"}
    {"GEORGE","DAVID"}
    
    Returns: { "GEORGE", "PEG" }

    "PEG" went to club1 and club2, and "GEORGE" went to club2 and club3.

  2. {"DOUG","DOUG","DOUG","DOUG","DOUG"}
    {"BOBBY","BOBBY"}
    {"JAMES"}
    
    Returns: { }

    Here, no one went to more than one club location.

  3. {"BOBBY"}
    {"BOB","BOBBY"}
    {"BOB"}
    

    Returns: { "BOB", "BOBBY" }

    Note that "BOB" is sorted before "BOBBY"

  4. {"BOBBY","HUGH","LIZ","GEORGE"}
    {"ELIZABETH","WILL"}
    {"BOB","BOBBY","BOBBY","PAM","LIZ","BOBBY","BOBBY","WILL"}
    

    Returns: { "BOBBY", "LIZ", "WILL" }

  5. {"JAMES","HUGH","HUGH","GEORGE","ELIZABETH","ELIZABETH","HUGH",
    "DAVID","ROBERT","DAVID","BOB","BOBBY","PAM","JAMES","JAMES"}
    {"BOBBY","ROBERT","GEORGE","JAMES","PEG","JAMES","DAVID","JOHN","LIZ",
    "SANDRA","GEORGE","JOHN","GEORGE","ELIZABETH","LIZ","JAMES"}
    {"ROBERT","ROBERT","ROBERT","SANDRA","PAM","BOB","LIZ","GEORGE"}
    

    Returns: { "BOB","BOBBY","DAVID","ELIZABETH","GEORGE","JAMES","LIZ","PAM","ROBERT", "SANDRA" }

  6. {"LIZ","WILL","JAMES"}
    {"JOHN","ROBERT","GEORGE","LIZ","PEG","HUGH","BOB","BOBBY","ROBERT","ELIZABETH","DAVID"}
    {"PAM","DAVID","SANDRA","GEORGE","JOHN","ROBERT","SANDRA","GEORGE"}
    

    Returns: { "DAVID", "GEORGE", "JOHN", "LIZ", "ROBERT" }

  7. {"PEG","ROBERT","PAM","JOHN","DAVID","JOHN","ROBERT",
    "GEORGE","HUGH","WILL","JAMES","JAMES","BOBBY","BOBBY","SANDRA"}
    
    {"SANDRA","BOB","PAM","JAMES","WILL","DAVID","BOBBY","GEORGE",
    "WILL","LIZ","BOBBY","ROBERT","WILL","BOB","BOBBY","ELIZABETH","HUGH"}
    
    {"WILL","PEG","ELIZABETH","DAVID","HUGH","BOBBY","JOHN","SANDRA","ELIZABETH",
    "ELIZABETH","SANDRA","GEORGE","PAM","ELIZABETH","BOBBY","DAVID","PAM"}
    

    Returns:

    { "BOBBY",
     "DAVID",
     "ELIZABETH",
     "GEORGE",
     "HUGH",
     "JAMES",
     "JOHN",
     "PAM",
     "PEG",
     "ROBERT",
     "SANDRA",
     "WILL" }
    

  8. {"AHHOZY","AHHAPLL","ASNV"}
    
    {"AHDLTOE","AHUKPJ","AHDENCTPP","AHDENCJ","AHDLNZC","AHDLTOGG","AHHAPMBG",
    "ALE","AHBHA","AHUKP","AHDQMILLP","AHDENEDY","AHDENEE","AHHOHVCX","AHISK",
    "AHW","AQDB","AHUP","AQDBNPU","AGWZUV","AHHOSUW","AHXS","AHDENCP","AHDQM",
    "AHDLTURV","AHBHVV","AHDQMILL","AHDQMD","AHH","AHDLTU","AHISFNO","AHURF",
    "AH","AHHAPNQ","AQPL","AHDXL","AHDLTUGX","AHDLT","AHUKRC","AHDLTUGX",
    "AQDTXYX","AGWZS"}
    
    {"AHHAPMFF","AHURA","AHHOZ","AHISKH","AHUPR","AHHAPM","AHUKRHIN","AHHAP",
    "AHDLTMO","AHDLTUJ","AHDQY","AHUK","AHDENEDY","AHWK","AHHOZGJJ","AHXS",
    "AHDLTUREL","AHHOZQNL","AHHOSUWOS"}
    

    Returns: { "AHDENEDY", "AHXS" }