Untitled

mail@pastecode.io avatar
unknown
plain_text
14 days ago
899 B
2
Indexable
Never
import java.util.*;

class Main{
    
    static void findSymParis(int arr[][]){
        HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>();
        for(int i=0;i<arr.length;i++){
            int first = arr[i][0];
            int sec = arr[i][1];
            Integer val = hm.get(sec);
            
            if(val!=null && val == first){
                System.out.println(sec+"=="+first);
            }else{
                hm.put(first, sec);
            }
        }
    }
    
    public static void main (String args[]){
        int arr[][] = new int[5][2];
        arr[0][0]=11; arr[0][1]=20;
        arr[1][0]=30; arr[1][1]=40;
        arr[2][0]=5; arr[2][1]=10;
        arr[3][0]=40; arr[3][1]=30;
        arr[4][0]=10; arr[4][1]=5;
        
        findSymParis(arr);
    }
}



// int arr[] = {{11,20}, {30,40}, {5,10}, {40,30}, {10,5}}

// (a,b) (c,d)

// b==c ?
// a==d ?
Leave a Comment