Finding all possible subarrays
for ( int i = 0 ; i < len ; i ++ ) { for ( int j = i ; j < len ; j ++ ) { int val = digitProduct ( digits , i , j ) ; if ( products . find ( val ) != products . end ( ) ) return false ; else products . insert ( val ) ; } } return true ; }