#479

Largest Palindrome Product

master · 1825 · lc hard +32 · verified · 38.2% accepted · 193 likes · top 17%

play →

Description

Given a positive integer n, find the largest palindrome that equals the product of two n-digit positive integers. Because the answer may be enormous, 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

Code

1
2
3