Java program for the above approach
import java . io . * ; import java . lang . * ; import java . util . * ; class GFG { static int MAX = ( int ) ( 1e5 ) ; static class Key { int arr [ ] ; Key ( int arr [ ] ) { this . arr = arr ; } @ Override public int hashCode ( ) { return 31 + Arrays . hashCode ( arr ) ; } @ Override public boolean equals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null || ( getClass ( ) != obj . getClass ( ) ) ) return false ; Key other = ( Key ) obj ; if ( ! Arrays . equals ( arr , other . arr ) ) return false ; return true ; } }