You have a truck moving around a circular track with gas stations spaced out around the circle. Each station has a finite amount of gas. The gas tank on the truck is infinit
static int findIndex(int A[], int B[]) { int N = A.length; int start=0; boolean isBreak=false; int total = 0; do { for(int i=start;i