What if you're unable to come up with an optimized way of solving a coding question? Is it considered bad if you can only think of the bruteforce solution but you can code it perfectly? Do you start coding the bruteforce solution after a few minutes, or would you rather keep trying to think of the optimized solution? As an interviewer, do you give a negative feedback in such cases?
Not sure on Apple but at Google the bar is so high if you don’t code the optimal solve you’re toast. Even at LinkedIn I got failed for a correctly coded optimal solution because it took too long.
I think you’re usually expected to just talk through the brute force solution, at most. Focus on thinking of and writing the optimal one
I think it depends on what you’re doing during the interview and how your interacting and listening to the interviewers. If your talking and explaining what you’re doing and admitting your approach is brute force, that’s way different from silently coding and/strongly defending your sub-optimal design. That said, many interviewers ask the same questions for years and they’ll know if the candidate is meeting the bar... so brute force might not cut it in any situations
From the folks I know at Google, it sounds like brute force = failure. Most CS graduates should be able to brute force most problems; they’re in a position that allows them to hire the best, so why hire someone that’s just ok? (That said, I know a SWE at Google who’s dumb as a bag of rocks, so anything’s possible!)
From my experience brute force only is a failure. I interviewed there and got optimal solutions to every problem but “didn’t solve them fast enough” and got a No within a day.