The phone screen was one hour, and the question was one of the ones people have already posted about: Camel Cards. I picked the option where the AI helps write the code.
A hand has 5 cards, and there are 7 hand types in total, each with its own weight, ordered from strongest to weakest.
Part one: first I read the problem and made clear that I would create 1 abstract class HandType and 1 class Hand, then define the fields and functions. After that I started implementing the evaluate(hand_1, hand_2) function to compare two hands.
While talking with the interviewer I explained my approach and how I planned to write it, and then handed it over to the AI to implement.
Part two: the follow-up was that when some cards are missing, you have to predict the best_hand and the worst_hand. For example, if you only have '99', the best is '99999' and the worst is '99321'. While I was talking through the approach, the interviewer said brute force was fine. So I just went with it, explained the approach to the AI clearly, and the AI wrote the actual code (honestly better than what I would have written by hand...). The hard part was the time complexity analysis at the end: if you break down every step and work it out carefully, it turns out to be polynomial.
Anyway, I barely finished the problem. I don't know the result yet, just sharing what I got.
Discussion
Loading comments…