If you as a normal software engine write a topological sort algorithm you likely failed your job. Your job is to use existing topological sort algorithms designed by people specialized in that area, implemented by people which are specialized in implementing and fine tuning algorithms (it's its whole own field of expertise, and overlooked field tbh.).
Or to reformulate it the job of an software engineer is to reuse existing components and basic building blocks to create larger components or programs, but it's not your job to create new basic building blocks. The job requires you to have an understanding of such components but not to memorize them.
Sure sometimes you have to create basic building blocks, but then doing so from memory is nearly always the wrong approach.
Leet code is not at all representative for "how well someone is suited for given job" (for most companies/offers, there always are exceptions).
While wasting everyone's time.
And favoring certain skill sets/problem solving approaches (memorization) over others (adaptability, deep generic understanding), at least in the way they tend to be implemented. It also strongly discriminates again anyone with exam anxiety and similar. Be aware that the points mentioned here apply to common leet code based screening (especially automatized screening), but not necessary asking people to solve some code problem in interviews (if you handle that appropriately).