I was asked these two questions with variations in the Meta phone screening for Senior ML engineer-
I got rejected. I've read posts where people were able to crack phone screens after answering just one question out of two with brute force and thought the bar for my phone screening was higher than usual as I felt pretty confident about being selected after the interview. Maybe because I was interviewing for a senior position?
Anyway, hard luck. :( The recruiter told me that the interviewer expected me to solve both questions flawlessly without any help from her. In retrospect, I think maybe instead of thinking out loud and working on solution with the interviewer, I should've tested my code rigorously myself silently before. But they mentioned in all webinars that one should talk out loud and explain code while writing, so honestly I think the expectation was unfair. I also practiced Top 50 questions list multiple times, but for phone screening I think I should've focussed on quality over quantity, and made sure I understood all possible test cases aspects of easy/medium problems before moving to harder ones.