Recently a friend asked me to solve a problem which he got on one of the interview, online assessment test. I decided to document my solution here. The companies name was Zopper and the question was asked on the initial online screening test on HackerEarth. Problem: HackerMan says that 5 and 8 are smart digits. A positive integer is called a smart number if it has only smart digits in its decimal representation. HackerMan has three sets of numbers. And he needs your help to find out the number of distinct smart numbers that he can make using one number from each of the three sets. You have to help in it Note: You must not count the same smart number more than once. Constraints The three sets will contain between 1 and 50 elements, inclusive. Each number in the three sets will contain numbers between 1 and 30,000, inclusive. Input Format The first, third and fifth lines will contain a number N that will specify the count of numbers in the sets on the second, fou...