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.
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)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Pandigital number in a given base
- Pandigital Product
- Count perfect square fractions from given array
- Product of given N fractions in reduced form
- Sum of given N fractions in reduced form
- Find N fractions that sum upto a given fraction N/D
- HCF of array of fractions (or rational numbers)
- Program to add two fractions
- Program to compare two fractions
- LCM and HCF of fractions
- Print all proper fractions with denominators less than equal to N
- Find the maximum cost of an array of pairs choosing at most K pairs
- Count number of distinct pairs whose sum exists in the given array
- Count valid pairs in the array satisfying given conditions
- Count unequal element pairs from the given Array
- Count of consecutive Fibonacci pairs in the given Array
- Find the count of even odd pairs in a given Array
- Count Sexy Prime Pairs in the given array
- Count of unordered pairs (x, y) of Array which satisfy given equation
- Count of replacements required to make the sum of all Pairs of given type from the Array equal
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.