int distanceBetweenBusStops(int* distance, int distanceSize, int start, int destination){ int dst1=0,dst2=0; int i=start; while(i%distanceSize != destination){ dst1+=distance[i%distanceSize]; i++; } i=start; while(i%distanceSize != destination){ i--; if(i<0) i=distanceSize-1; dst2+=distance[i%distanceSize]; } return (dst1<dst2)?dst1 :dst2; }