[Snap][US][Staff SWE] Phone Screen Interview
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?