Talentd
FleetCode

479. Largest Palindrome Product

Hard40.2% acceptance1 company

Given an integer n, return the largest palindromic integer that can be represented as the product of two n-digits integers. Since the answer can be very large, return it modulo 1337.

Example 1:

Input: n = 2
Output: 987
Explanation: 99 x 91 = 9009, 9009 % 1337 = 987

Example 2:

Input: n = 1
Output: 9

Constraints:

  • 1 <= n <= 8

Asked at 1 company

17:01
Still stuck?Read 3 approaches, or watch a walkthrough.
Open solution
Loading editor…
1class Solution:
2 def largestPalindrome(self, n: int) -> int:
3
Starter codePython 3Spaces: 4
Examples
Input
2
Input
1
Your code is saved on this device.Solution