# Two City Scheduling & Longest Common Prefix

### Interview Summary

**Problem type**

Two City Scheduling & Longest Common Prefix

**Interview question**

**Two City Scheduling:** Given a 2D cost array where each entry represents the cost to fly a person to either City A or City B, determine the minimum total cost to fly exactly n people to each city. The candidate identifies a greedy approach — sorting by the cost differential (A minus B) and splitting the sorted array down the middle.

**Longest Common Prefix:** Given two arrays of positive integers, find the length of the longest common prefix shared between any pair of integers (one from each array). The candidate precomputes all integer prefixes for the first array into a set using repeated integer division by 10, then searches each element of the second array against that set.

### Interview Feedback

**Feedback about Golden Eel (the interviewee)**

- Advance this person to the next round?  Yes
- How were their technical skills? 4/4
- How was their problem solving ability? 4/4
- What about their communication ability? 4/4

> Overall Impression
> This was an exceptional interview performance. You demonstrated strong problem-solving skills, excellent communication, and a highly structured approach throughout both problems. What stood out most was your ability to clearly articulate your reasoning, align the interviewer with your thought process, and efficiently translate ideas into clean, correct code. You consistently exhibited behaviors that interviewers look for in strong candidates: clarifying requirements, discussing tradeoffs, identifying appropriate algorithms quickly, writing maintainable code, and validating your solutions through walkthroughs. Overall, this was one of the strongest interview performances possible and reflected a high level of technical maturity.

> **What You Did Well**
> - Excellent communication from start to finish.
> - Strong problem analysis and edge case awareness.
> - Quick identification of the correct algorithmic approach.
> - Great use of comments and solution structure.
> - Strong optimization mindset.
> - Fast and efficient implementation.
> - Good responsiveness to hints.
> - Strong validation and debugging process.

> **Areas to Continue Building On**
> - There were very few meaningful areas for improvement in this interview. Most feedback falls into the category of continued refinement rather than addressing weaknesses.
  
> **How to Continue Improving**
> 1. Keep leading with structured communication.
> 2. Maintain your validation process.

> **Final Thoughts**
> This was a standout interview performance. You combined strong technical problem-solving with excellent communication, clear reasoning, efficient coding, and thorough validation. The interview consistently felt organized and collaborative, and it was easy to understand both your thought process and your implementation decisions. The most impressive aspect of the session was not just that you arrived at the correct solutions; it was how clearly and confidently you communicated your approach every step of the way. Your comments, explanations, and structured problem-solving process made it exceptionally easy to follow your reasoning.

**Feedback about Admiral Dictaphone (the interviewer)**

- Would you want to work with this person?  Yes
- How excited would you be to work with them? 4/4
- How good were the questions? 4/4
- How helpful was your interviewer in guiding you to the solution(s)? 4/4

### Interview Transcript

**Admiral Dictaphone:** Cool, yeah, go ahead and introduce yourself.

**Golden Eel:** Yeah, so just keep it anonymous. I'm Golden Eel. I have 3 years of industry experience. I just graduated from my master's this past April. I have an interview coming up for [REDACTED]. It's for [REDACTED] in the next week, and it's the onsite. So it's the final round, and I just wanted to get a little bit of hands-on algorithms practice before I jump into it.

**Admiral Dictaphone:** Cool. Well, congrats. I have worked at [REDACTED] before, so I know how their interviews have gone. They're pretty straightforward, so nothing too crazy. But yeah, so I've worked at [REDACTED]. I currently work at Meta. I've been there for about 2 years now and I just like interviewing people, so, and providing feedback. So that being said, let's get started. What language are you most comfortable with?

**Golden Eel:** I'm most comfortable with Python.

**Admiral Dictaphone:** Sounds good. Let's switch it over to Python.

*Subsequent conversation continues regarding problem-solving strategies and coding implementation.*

---

**Problem-Solving Process Sample:**  
For the two-city scheduling problem:
1. Determine the cost array.
2. Sort the array based on the difference in cost between City A and City B.
3. Select n individuals for City A and the remaining for City B based on the sorted order.
4. Calculate the total cost.

For the longest common prefix problem:
1. Precompute the prefixes for the integers in the first array.
2. Compare each integer in the second array to the prefixes and keep track of the maximum length found.

---

### Conclusion
This interview presented a strong demonstration of both problem-solving skills and the ability to articulate thoughts clearly and effectively. Continued practice and refinement can further enhance performance in future technical interviews.
