Sunday, April 21, 2019

Find the first circular tour that visits all gas station or petrol bunks

Find the first circular tour that visits all gas station or petrol bunks where there are N gas stations are there in a circle. 

You are given two sets of data:
1. The amount of gas/petrol that every petrol pump has.
2. Distance from that gas/petrol pump to the next petrol pump.
Node node1 = new Node("1", 6, 4);

"1" is the gas station name.
6 is amount of gas can be filled at gas station "1"
4 is the distance from current gas station to next one.

Calculate the first point from where a truck will be able to complete the circle 

Input 1
Node node1 = new Node("1", 6, 4);
Node node2 = new Node("2", 3, 6);
Node node3 = new Node("3", 7, 3);
Output
Execution 1: 3

Input 2
Node node1 = new Node("1", 4, 6);
Node node2 = new Node("2", 6, 5);
Node node3 = new Node("3", 7, 3);
Node node4 = new Node("4", 4, 5);
Output
Execution 2: 2






No comments:

Post a Comment