Python Solution with。。。out explanation


  • 0
    A

    '''
    def largestPalindrome(n):
    """
    :type n: int
    :rtype: int
    """
    largestP = 0
    for i in range(pow(10, n)-1,pow(10, n-1),-1):
    for j in range(pow(10, n)-1,pow(10, n-1),-1):
    if list(str(i * j)) == list(str(i * j))[::-1]:
    if i * j > largestP:
    largestP = i * j
    return largestP%1337
    '''
    life is short,you need python
    life is fast,python is slow
    my english is as not well as my programming
    so I want to make progress with friends which made on the leetcode everyday
    at last ,I know my solution is so stupid,no shortcut ,welcome to discuss,thx


  • 0
    D

    The code is Time Limit Exceeded when n>=4.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.