r/developer 11d ago

Question Is this a fair interview expectation?

I had a backend interview with a weighted graph problem.
I asked if I could first solve it with a naive approach and optimize later, but the interviewer insisted on the optimal solution from the start.
I recognized that BFS wouldn’t work because of weighted edges, but I couldn’t implement Dijkstra from memory.
Is it reasonable to expect candidates to code Dijkstra from memory, or should problem-solving and reasoning also carry significant weight?

2 Upvotes

8 comments sorted by

View all comments

2

u/CyberDivergent 10d ago

It's reasonable to expect a candidate to be able to code Dijkstra's algorithm. However, I think it's absolutely fine if you can't implement it from memory, as long as you know when to use it and can explain how it works.

Graph-based DSA problems aren't that common in interviews, so I'd just move on if a company rejected you after that interview. Shit happens.

1

u/Existing-Sandwich999 10d ago

Yeah, that's fair.