Find the largest palindrome made from the product of two n-digit numbers. Since the result could be very large, you should return the largest palindrome mod 1337. Example: Input: 2 Output: 987 Explanation: 99 x 91 = 9009, 9009 % 1337 = 987 Note: The…
你需要找到由两个 n 位数的乘积组成的最大回文数.由于结果会很大,你只需返回最大回文数 mod 1337得到的结果.示例:输入: 2输出: 987解释: 99 x 91 = 9009, 9009 % 1337 = 987说明:n 的取值范围为 [1,8].详见:https://leetcode.com/problems/largest-palindrome-product/description/ C++: class Solution { public: int largestPalindro…
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not considered a palindrome here. Note: Assume the leng…
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = "aab",Return [ ["aa","b"], ["a","a","…
Given a non-empty string s, you may delete at most one character. Judge whether you can make it a palindrome. Example 1: Input: "aba" Output: True Example 2: Input: "abca" Output: True Explanation: You could delete the character 'c'. N…
Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false Example 2: Input: 1->2->2->1 Output: true Follow up:Could you do it in O(n) time and O(1) space? 这道题让我们判断一个链表是否为回文链表,LeetCode 中关于回文串的题共有六道,除了这道,其…
Determine whether an integer is a palindrome. Do this without extra space.(不要使用额外的空间) Some hints: Could negative integers be palindromes? (ie, -1) If you are thinking of converting the integer to string, note the restriction of using extra space. You…
题目描述 给定一个字符串 s,找到 s中最长的回文子串.你可以假设 s 的最大长度为1000. 示例1 输入: "babad" 输出: "bab" 注意: "aba"也是一个有效答案. 示例2 输入: "cbbd" 输出: "bb" 解题 对于这道题,最简单的方法就是暴力求解了.对于很多算法题,我想会暴力求解是最基本的能力,但也绝不能满足于暴力,而且很多题的暴力解法都是很类似的. 这道题与其他的暴力解法一样…
给定一个字符串 s,将 s 分割成一些子串,使每个子串都是回文串.返回 s 所有可能的分割方案.例如,给出 s = "aab",返回[  ["aa","b"],  ["a","a","b"]]详见:https://leetcode.com/problems/palindrome-partitioning/description/ Java实现: class Solution { publ…
给定一个包含大写字母和小写字母的字符串,找到通过这些字母构造成的最长的回文串.在构造过程中,请注意区分大小写.比如 "Aa" 不能当做一个回文字符串.注意:假设字符串的长度不会超过 1010.示例 1:输入:"abccccdd"输出:7解释:我们可以构造的最长的回文串是"dccaccd", 它的长度是 7.详见:https://leetcode.com/problems/longest-palindrome/description/ C++: c…