• + 0 comments

    import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;

    public class Solution { public static int dfs (int arr[][],boolean visited[],int k) { visited[k]=true; int count =1; for(int i=1;i }
    } return count; } public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner in = new Scanner(System.in); int n = in.nextInt(); int arr[][]= new int [2*n+1][2*n+1]; for(int i =0;i } int min = Integer.MAX_VALUE; int max = Integer.MIN_VALUE; for(int i =1;i<=2*n;i++) { if(visited[i]==false) { int value= dfs(arr,visited,i); if(value==1) continue; if(valuemax) max = value;

        }
        }
        System.out.println(min+" "+max);
    }
    

    } //can u tell why only few test case are passing this code please