I’ve never been through a coding interview. In my opinion, it’s a waste of time unless the candidate is going to sit in a room and write code, without question, for whatever specs they receive.
If a company insisted, then they would first have them answer a number of questions about the spec, from every impact to the end-user to how it interfaces with the rest of the product. Maybe the problem shouldn’t even be done. Failure to answer those questions produces things like the most recent Medium upgrade.
(By the way, I took a coding test, which represented reality, for my last job. The first 12 people failed. I had 3 answers for each problem).