Sunday, April 5, 2020

Case study: Find minimum sum for each worker to bike distance

April 5, 2020

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.

  1. Calculate the distance between worker and bike, calculate once and save it using extra space;
  2. 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