Given an array of n numbers. The task is to find the number of pairs that can be taken from the given which on concatenation will contain all the digits from 0 to 9.
eg :
String[] = {
129300455”,
“5559948277”,
“012334556”,
“56789”,
“123456879”
}
{“129300455”, “56789”},
{ “129300455”, “123456879”},
{“5559948277”, “012334556”},
{“012334556”, “56789”},
{“012334556”, “123456879”}
are the pair which contain all the digits fromThe interview and me had a discussion,First I computed the count arr of size 10 for each of the string, then using the bitwise OR, checked if the number is equal to 1023 and counted the result accordingly. Its been long since I got a bit wise problem in a interview :P
Similar problem :
Pairs whose concatenation contain all digits
Winning Lottery Ticket