Just had my phone screen today. Got asked these two questions:
Q1: A town is building a watchtower. The watchtower is located at (0, 0). Each unit height of the watchtower has a cost H. There are N houses located at (x, y) coordinates. Each house will pay cost C if it comes under the surveillance of the watchtower. The horizontal distance covered by the watchtower is the same as it's height. Find out the max profit you can make.
Inputs:
In the beginning the watchtower was located at the origin. For the followup he said watchtower location will be provided. The (x, y) coordinates can be floats as well as H and C.
Q2:
Given two strings s1 and s2, find out if they only differ by the insertion of a phrase.
Example:
'cute litte' is the added phrase everything else is the same so return True
Example:
-> Return False
I think I got lucky with the set of questions. First question I was able to solve in ~15 minutes. I instantly got the approach. The interviewer actually said he only had one question prepared and asked me after this if I wanted to solve another one. TIFU and I said yes but I could only come up with the approach for the second one and before I could start writing code, we ran out of time.