It was a 45 min interview, no introductions straight to the questions. Two questions asked:
I have seen some similar questions before so it was quite simple to arrive to a solution. I gave a recursive solution where I would just check if I had skipped a character or not already.
This question was the first time I have ever seen. I did some brain storming and offered a two heaps solution, to witch the interviewer reminded me it was a sorted array. So I came up with a binary search solution with kinda of a sliding window, where I would find the closest element to X and expand from there.
The solution I came up with on the spot is the second one on the solutions tab. Sadly it was not enough, the interviewer wanted the third solution, and to be honest even now that I see it I am not quite sure how to get to it unless I had seen it before. The interviewer was trying to get me there but she would just say something like, ok if you have lenght - K, how can you find your boundaries without finding X? And I am just sitting there thinking "Yeah, how?".
At the end when there was just 4 minutes left on the interview she asked me to code the solution I told her, because of all of the discussion I didn't have any code yet.
After the interview I was just sitting waiting for the rejection email and thinking "Whyy?". Why some interviewers have this mentality that unless you give the perfect solution you are not a good candidate.
I already work at SAP and I am pretty confident on my skills but still, it is frustrating when you face something like this.