What is Circular Tour problem and how do you solve it?

DSA
Medium
Flipkart
117.1K views

This question refers to finding a starting point for a circular tour given fuel and distance constraints. It tests greedy algorithm skills.

Why Interviewers Ask This

This problem tests logical reasoning and greedy strategy application. Interviewers ask it to see if you can handle circular buffer problems efficiently. It is a classic coding challenge for technical rounds.

How to Answer This Question

Explain the problem: find a start station where total fuel >= total distance. Use a two-pointer or single-pass greedy approach. Track surplus fuel and reset start if deficit occurs.

Key Points to Cover

  • Greedy strategy
  • Fuel surplus tracking
  • Deficit handling
  • Single pass solution

Sample Answer

The Circular Tour problem asks for a starting petrol pump from which a vehicle can complete a full circle. We iterate through stations, maintaining current fuel. If fuel drops below zero, we reset the start to the next s…

Common Mistakes to Avoid

  • Using brute force O(N^2)
  • Ignoring total fuel check
  • Incorrect reset logic

Sound confident on this question in 5 minutes

Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.

Try it free

Related Interview Questions

Browse all 107 DSA questionsBrowse all 131 Flipkart questions