easy solution, time complexity: O(1), language agnostic


  • 0
    J
        def largestPalindrome(self, n):
            """
            :type n: int
            :rtype: int
            """
            solutions = [
                None, 9, 9009, 906609, 99000099,
                9966006699, 999000000999,
                99956644665999, 9999000000009999
            ]
            return solutions[n] % 1337
    

Log in to reply
 

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