Taxi drivers and Lyft

Правка en1, от Abhizen, 2018-11-19 12:54:19

I have solved this problem Taxi drivers and Lyft using two approaches. My first solution does not pass test case 5 where as second solution passes all test cases. Test case 5 is pretty big to figure out the mistake. Please help me figure out what is the problem with my first approach.

  1. By iterating over people array and storing distance of next taxi driver in a separate array. Then I am iterating again on people array to count riders for each taxi based on distance between taxi driver and rider. First solution
  2. By iterating over people array and storing taxi driver coordinate and rider coordinate in separate array. Then I am iterating over rider coordinate array and iterate over taxi driver coordinate array in nested loop based on distance between rider and taxi driver. Second solution
Теги #sorting, lyft, #array

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Abhizen 2018-11-19 12:54:19 996 Initial revision (published)