// Driver Code public static void Main(string[] args) { PetrolPump[] arr = new PetrolPump[] { new PetrolPump(6, 4), new PetrolPump(3, 6), new PetrolPump(7, 3) }; int start = printTour(arr, arr.Length); Console.WriteLine(start == -1 ? "No Solution" : "Start = " + start); /* * Output: * * start = 2 * Time Complexity: We are visiting each petrol pump exactly once, therefore the time complexity is O(n) * * Auxiliary Space: O(1) */ }
static void Main(string[] args) { PetrolPump[] arr = new PetrolPump[] { new PetrolPump(6, 4), new PetrolPump(3, 6), new PetrolPump(7, 3) }; int start = printTour(arr, arr.Length); Console.WriteLine(start == -1 ? "No Solution" : "Start = " + start); /* * Output: * * start = 2 * Time Complexity: O(n) * * Auxiliary Space: O(1) */ }