Summary
I had a phone screen with Snap where I was presented with a problem focused on distributing people across meeting rooms to maximize the minimum distance between them.
Full Experience
I recently completed a phone screen with Snap. During the interview, I was given a problem that involved managing meeting rooms and distributing a specific number of people, 'k', among them. The core challenge was to arrange these people in such a way that the maximum possible distance between any two individuals was achieved. We discussed the problem thoroughly, including the provided example to clarify the constraints and expected output. My approach centered on understanding the 1-D array representation of the rooms and how to optimally place people to maximize the spacing.
Interview Questions (1)
You are given meeting rooms of size rooms. You need to distribute k people in these rooms such that they have maximum distance between them. Return the maximum distance possible.
Input : rooms = [7,8,3] k=7
Output : 2
We can represent the placement as a 1-D array[1,0,0,1,0,01], [1,0,0,1,0,0,0,1], [1,0,0]
The distance in the last room doesn't matter since there is only 1 person in that room.
Summary
I had a phone screen interview at Snap for a Staff SWE role in the US, where I was tasked with implementing Java's Math.sin(x) function using its Taylor Series. Although I received some hints, I passed this round and was downleveled for the onsite interview.
Full Experience
My recent phone screen interview at Snap for a Staff Software Engineer position in the US presented an interesting challenge. The core task was to implement Java's Math.sin(x) function, specifically using its Taylor Series definition: $$X - X^3/3! + X^5/5! - X^7/7!....$$ The interviewer prompted me to consider the practical aspects, such as when to terminate the infinite Taylor series to prevent an infinite loop, and what level of precision was expected for the returned double value. While I did require a few nudges and hints from the interviewer to guide me through these intricacies, I successfully navigated the problem. Ultimately, I passed this phone screen and will be moving on to the onsite interviews, though I was informed that I would be downleveled.
Interview Questions (1)
Implement Java's Math.sin(x) function which takes an input number and returns the sin() double value.
sin(x) is defined by the Taylor Series as: $$X - X^3/3! + X^5/5! - X^7/7!....$$
Challenges:
- Taylor series has no end. When do you decide to terminate and return value to avoid infinite loop?
- What is the precision to aim for return value?