Mobile number and similarity
There is a very huge database and every user only inserts into system using phone number (for simplicity, we need to provide only 10 digit number). As soon as user registered, we have to count how Many odd digits are there and how many even digits are there in phone number. Requirement is to notify new user saying that your phone number has similarity with X users (X is number of people whose phone number have same odd and even digits count). What data structure is to be used here ? I would go with map of int,int as key will be no of odd digits count and corresponding user count will be value of map. Any other data structure will be good here ? This map solution seems to me a constant space Requirement and any thoughts please ? P.s. : do not go into database please. Requirement is from C++ and In memory storage of data.