Location: Dublin Level: L2 Years of Exp: 2 years
The first step was resume shortlisting. I applied for the role directly on Stripe's website and after a week, I was contacted by the recruiter.
A call was scheduled with the recruiter where she discussed the interview process, expectations, and the next steps. She informed me that there would be a screening round followed by an onsite interview if the screening went well.
After a brief introduction, the interview began with a data structures and algorithms question.
Question
You are given a string S of 'Y' and 'N' separated by spaces, for example: Y N N Y N Y Y N. S[i] represents if there are any customers waiting at our shop on the i<sup>th</sup> day.
We are also given an index ind on which we will open or close the shop. We need to find the total loss if we close the shop on the ind day.
There will be a loss of 1 if we close the shop on the i<sup>th</sup> day and there exists any customer waiting on the day after i. Similarly, there will be a loss of 1 if we are open on the i<sup>th</sup> day and there are no customers before i.
Example: S= "Y N N Y N Y Y N" and ind = 2 Answer: 1 (1 day when no customer is there before ind 2) + 3 (3 days when customers are waiting after ind 2) = 4
Verdict-1
I provided a brute force approach to check for the number of N on the left of ind and the number of Y on the right of ind.
The interviewer asked me to code it as he did not want me to optimize it. He asked me to write the complete code (main function, creating the structure to take and print test cases).
I initially assumed S does not contain spaces in between, but when I completed my code he then told me to consider this. It took me 30 minutes to write this because of this confusion.
I modified my code and it got executed.
He then asked a follow-up question.
Follow-up 1 Find the day when the loss is minimum.
Verdict-2
This was super easy, just iterate for all the ind and find the minimum. I coded this in like 2-3 minutes. And running his test cases took 5 more minutes.
Follow-up 2 Finally, he showed me the bigger picture. He told me that there are some logs that contain this kind of pattern. For each valid pattern, you have to print the pattern and find the minimum loss for that. The logs would be like: `\t\t L R L R
mtswioehdvdfoj R L R /t/n` it could be very random.
Verdict-3 I ran out of time since I already took around 40 minutes to solve the above two parts. But I explained to him the approach that we will first extract these logs and then apply the same computation on each log.
Conclusion After 2 days, I received an email from the recruiter that they were not moving forward with my application. My overall experience was good. You need to be very fast in their interviews. It is always good to ask questions beforehand related to the formatting and how input is provided to avoid any last-minute changes in your code. Also, I don't think solving the 2nd follow-up could be done in the time provided even if I had completed the other parts a bit early. Happy to know your opinions on this.