I will add more later.
Here is the gist.
Here is my code written in C#. I did not have time to run using web compiler and tested that it works.
Here is the section to show feedbacks.
Actionable Items
I asked two interviewees today using the campus bike distance II algorithm, the interviewee on 10:00 PM mock interview tried to write a dp solution but failed, the subproblem is not well-defined. He told me that Leetcode has this problem.
I read the solution on this medium blog, and I have a few things to improve in my above code.
- Calculate the distance between worker and bike, calculate once and save it using extra space;
- DFS can be pruned, the idea is to terminate early if sum of distance partial result is bigger than minimum one already.
No comments:
Post a Comment