If the count of set bits in both masks are equal then return 1 as they have equal number of distinct odd and even digits
if ( countOfOddDigits == countOfEvenDigits ) { return 1 ; } return 0 ; } int & val = dp [ index ] [ evenMask ] [ oddMask ] ;