Count Pandigital Fractions pairs in given Array
Given an array arr, the task is to count the pairs in the array such that arr[i]/arr[j] is a Pandigital Fraction.
A fraction N/D is called a Pandigital Fraction if the fraction contains all the digits from 0 to 9.
Attention reader! All those who say programming isn't for kids, just haven't met the right mentors yet. Join the Demo Class for First Step to Coding Course, specifically designed for students of class 8 to 12.
The students will get to learn more about the world of programming in these free classes which will definitely help them in making a wise career choice in the future.
Input: arr = [ 12345, 67890, 123, 4567890 ]
The fractions are 12345/67890, 12345/4567890, and 123/4567890
Input: arr = [ 12345, 6789 ]
Approach: The idea is to iterate over every possible pair of the array using two nested loops and for every pair concatenate arr[i] and arr[j] into a single number and check if the concatenation of arr[i] and arr[j] is a Pandigital number in base 10 then increment count.
Below is the implementation of the above approach:
Time Complexity: O(N2)