Tech IndustrySep 14, 2018
Chaseghosted!

Will you asked to give another solution to a problem that is no more optimized than your current one?

ie, a tree-related problem has 3 ways to solve, time complexity is same across. Space complexity is such that recursive dfs is worst due to stackoverflow risk, followed by iterative DFS and then iterative BFS. 1) iterative DFS 2) iterative BFS 3) recursive dfs Now, if you already gave a working iterative DFS solution, how likely is the interviewer to ask you to 'solve it another way', even though any other way is not any more efficient? I can see if you give a recursive dfs solution, you may be asked 'can you do it iteratively to eliminate stack overflow risk', but vice versa?

Add a comment
Facebook πŸ‘οΈβ€πŸ—¨οΈ Sep 14, 2018

lmao we're not mind readers. Maybe the interviewer will ask that, maybe they won't because they want to move on to another question who tf knows? Just be able to cover all your bases while you're studying, but trying to strategize like this is stupid.

Microsoft TC_GTFO Sep 14, 2018

Unlikely, but not impossible. you will spend most of that 35 mins working on logic and coding and if you finish early then you will get another question.

New
rainbowcat Sep 14, 2018

Maybe you thought there's no other way, but in fact the problem could be solved using DP and interviewer want you to figure it out.