I added this question as a warm-up question before the other two main questions that are more conventional coding interview questions that involve algorithms and data structures. The solution is simpler than the solution to the two main questions.
To my surprise, I found that most candidates take half of the 45 minutes allotted to do this question. It's only meant to take no more than 10 minutes. Many do the other two questions in less time.
While I won't directly post the question here, I wonder if it's so simple that my candidates are wondering if there's a hidden trick. Could that be why the candidates are taking so long?
1. [The] question is intended to be a conceptually simple one.
2. There isn't anything inherently tricky about it.
3. I won't directly post the question here.
Without the question we can't tell you if it's simple to grasp. In other words, we can't evaluate the question from its solution.
I'm not saying you're getting all of the bad ones, but there's probably something going on if a supposedly simple problem (this, FizzBuzz, pick whatever you want) fails. Yeah, I know, someone's going to mention the environment, and the pressure of it being an interview, and that's certainly true.
All I can say to that is that I've posed FizzBuzz itself to someone who claimed aptitude, totally randomly over a chat session, not as part of an interview, just us chatting randomly. I think we were actually talking about how interviewing was such a pain. They themselves talked a great deal... but then never delivered on it.
Besides, you work at Google. Don't you see this all around you? They're already on the inside.
It sounds like the other two questions are rehearsed and expected, while the warm-up question is unexpected.
I dont have context to know how you're asking it, but if you're not already, be clear about what you're looking for in the answer and the amount of time / effort you think the candidate should spend.
The way I would solve something like that is by mentioning that it is a good approach to do time calculations with some library functions so that I won't have to deal with all the weird edge cases, then start with a loop over the months and later refine that to get rid of the loop, but it is very much possible that an interviewer might view this loop negatively.
There might also be some cultural aspects. While the Gregorian calendar is probably somehow used everywhere in the world, I think there might also be some other calendar formats being used in parallel.
If it is the first interview of the day, maybe the candidates are also just nervous? I remember when I had my on site interview at Google, the first warm up question had something to do with probability and could be easily solved with linearity of expectation. In the months before that interview I had dealt quite a lot with probability for my master thesis - but at that day I was quite nervous and I had not slept well, so I spend quite a lot of time on that question. I think I answered later questions better, although it was not enough in the end.
Do you usually see some correlation between the warm-up question and later performance?
I am not sure if that is necessary, but what might help is by starting to calculate the number of days from the start of the month and then adapt the question.
I have faced this in a coding interview(not at google). The coding question was so simple that I spent talking about different scenarios and edge cases that I was slower than expected. The interviewer said that, I have completed the most challenging part and its only a basic if statement. THAT'S IT! And I was like "This can't just be this?. There is a trick or I been getting ask a trick question here". As a candidate who has personally faced this an interview, preparing for FAANG interview sets the coding questions bar so high that even simple questions need to be analyzed over and over because as per a candidate this can't be that easy, right?!
If we simplify it to be fake dates by assuming all months have 30 days, and the input is MM/DD (i.e. 04/30), then it's trivial, multiplying MM*30 + DD.
That said, the solution for the real dates, would just be a bunch of maps ... month numbers mapped to how many days they have, { 1: 31, 2: 28 }, etc. Same for leap years, another map. And then it's the same formula as above but looking up the values first.
In other words, this may be hard for the wrong reasons I feel. Junior candidates would take longer, but it's bcause of the exceptions of date format. Perhaps you can think of a similar problem that uses something other than dates, and that has more regularity in its type.
Also, seemingly simple tasks can get people tangled up, particularly in an interview situation: there is a performance aspect to interviews, and this type of question can trip up people who are expecting your typical array/hashtable/linked-list style questions.
Whats the point of wasting time and attention span on dumb question if the real ones are following?
If they passed the warm up but failed one of the other two would they get a good rating from you?
The warm up seems pretty unnecessary.
As for your question unless you can determine some correlation with the time taken for warm up and acceptance - why does it really matter how long it takes them? I’d make the question even simpler, making all days of months the same and eliminating leap year logic.
As an aside, I found this kind of time wasting question to be not uncommon at Google and other FAANGs.