Given a value n, find out the largest palindrome number which is product of two n digit numbers.
Input : n = 2 Output : 9009 9009 is the largest number which is product of two 2-digit numbers. 9009 = 91*99. Input : n = 3 Output : 906609
Below are steps to find the required number.
1) Find a lower limit on n digit numbers. For example, for n = 2, lower_limit is 10.
2) Find an upper limit on n digit numbers. For example, for n = 2, upper_limit is 99.
3) Consider all pairs of numbers where ever number lies in range [lower_limit, upper_limit]
Below is the implementation of above steps.
The approach used in this post is simple and straightforward. Please comment if you find a better approach.
This article is contributed by Shivam Pradhan(anuj_charm). If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
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.
- Largest palindrome which is product of two N-digit numbers : Set 2
- Sum and product of k smallest and k largest prime numbers in the array
- Sum and product of k smallest and k largest composite numbers in the array
- Smallest and Largest Palindrome with N Digits
- Product of N with its largest odd digit
- Numbers less than N which are product of exactly two distinct prime numbers
- Sum of all N digit palindrome numbers
- Count of N-digit Palindrome numbers
- Sum of all palindrome numbers present in an Array
- Find all palindrome numbers of given digits
- Sum of all Palindrome Numbers present in a Linked list
- Count the number of digits of palindrome numbers in an array
- Absolute difference between the Product of Non-Prime numbers and Prime numbers of an Array
- Nth term of a sequence formed by sum of current term with product of its largest and smallest digit
- Largest Even and Odd N-digit numbers
- Find two numbers with sum and product both same as N
- Check whether product of 'n' numbers is even or odd
- Largest Even and Odd N-digit numbers of base B
- Smallest and Largest sum of two n-digit numbers
- Largest number in [2, 3, .. n] which is co-prime with numbers in [2, 3, .. m]