https://www.codechef.com/SEPT20B/problems/COVID19B

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
    static long findCount(long v1,long v2,long v3,long d1,long d2,long d3){ 
     long flag=0,check=0,count=1;
	      for(int t=0;t<10;t++){
	           d1+=v1;
	           d2+=v2;
	           d3+=v3;
	           
	           if(d1==d2 && d2==d3){
	               count=3;
	               return count;
	           }
	           if(d1==d2 && check==0){
	               count++;
	               flag=1;
	           }
	           if(d1==d3 && (flag==1^check==1)){
	               count++;
	           }
	            if(d2==d3 && check==0 && flag==0){
	               count++;
	               check=1;
	           }
	       }
	       return count;
}
	       
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc=new Scanner(System.in);
	    
	    long T=sc.nextLong();
	    label:
	    while(T-->0){
	        long count1=1,t,sum=0,count2=1,count3=1,i,d1=0,d2=1,d3=2,v1,v2,v3,flag=0,check=0;
	        int N=sc.nextInt();
	        
	        v1=sc.nextInt();
	        v2=sc.nextInt();
	        v3=sc.nextInt();
	        
	        if(v1==v2 && v2==v3){
	            System.out.println(1+" "+1);
	            continue label;
	        }
	        
	       count1=findCount(v2,v1,v3,d2,d1,d3);
	       count2=findCount(v1,v2,v3,d1,d2,d3);
	       count3=findCount(v1,v3,v2,d1,d3,d2);
	       
	        int[] count=new int[3];
	        count[0]=(int)count1;
	        count[1]=(int)count2;
	        count[2]=(int)count3;
	        
	        int best=Arrays.stream(count).min().getAsInt();
	       int worst=Arrays.stream(count).max().getAsInt();
	     // System.out.println(Arrays.toString(count));
	       System.out.println(best+" "+worst);
	    }
	}
}

I cant find the test cases for which my code goes wrong. It gave the correct answer for all the test cases that i have tried. Can you please point out those edge test cases. Thank you

Please explain the logic behind your code.
Try these ->
3 5 2 4 1 ; ans : 3 5
3 5 2 1 4 ; ans : 2 5
reply if your answer was correct or not with your logic behind you code.