I was expecting dsa question but got OOD? And first I thought it was DSA halfway through the interview time realized it was OOD.
Question:
You have a game and there are combos(consists of cards of 3) in a game which consists of 3 colors. Each player gets 3 cards and each card have value and color. Determine the winner.
Combos:
3 same color
3 same value
etc.
First, I focused too much on the determining the winner section based on the given combo. Using set to check whether given card has 3 same colors or values. It turns out interviewer wanted to see OOD. I asked the question in the beginning of the interview is this DSA or OOD and interviewer answered you need to figure it out. Nothing wong from the interviewer's side I am just posting here to say OOD is expected in the phonescreen too.
One possible solution:
abstract class Combo { // can be interface as well
public abstract ComboResult checkCombo(List<Card> hand);
}
class ComboResult {
private Player player;
private int ranking;
public ComboResult(Player player, int ranking) {
this.player = player;
this.ranking = ranking;
}
public Player getPlayer() {
return player;
}
public int getRanking() {
return ranking;
}
}
class ColorCombo extends Combo {
@Override
public ComboResult checkCombo(List<Card> hand) {
// Implement color combo logic here
// Calculate ranking
return new ComboResult(null, 0); // Return ComboResult with appropriate player and ranking
}
}
.. new combos can be added as well

