Hi Guys, I got asked a question during a phone interview today. Wondering how one might solve it and with which data structures / algorithms.
Question:
We are given a list of Scheduler objects (structure below) and are asked to return the same list where we should group first by patient, then subgroup by pharmacy with the lowest priority. So, the first set of rows should be for the patient with the lowest priority from the list (priority is unique throughout the list), then within that patient group, first display the pharmacy group with the lowest priority and within the pharmacy group, first display the row with lowest priority.
class Schedular {
private int id;
private int priority; --unique values across the list.
private String patient;
private String pharmacy;
}