File: root - text - article - 2019 - 10 - daily-problem-twitter-palindrome.txt
Tags: 每日算法, 回文数, 面试, Python, daily problem, palindrome, algorithms, twitter interview question, python, | English | Home Page | Category: Computing | 508 Views, 18798 Search Bots | 69 Words
| Browse | Archive
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Tags: 每日算法, 回文数, 面试, Python, daily problem, palindrome, algorithms, twitter interview question, python, | English | Home Page | Category: Computing | 508 Views, 18798 Search Bots | 69 Words
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Hi, here's your problem today. This problem was recently asked by Twitter:
A palindrome is a sequence of characters that reads the same backwards and forwards. Given a string, s, find the longest palindromic substring in s.
Example:
Input: "banana"
Output: "anana"
Input: "million"
Output: "illi"
Tags: 每日算法, 回文数, 面试, Python, daily problem, palindrome, algorithms, twitter interview question, python, | English | Home Page | Cateogry: Computing | 508 Views, 18798 Search Bots | 69 Words A palindrome is a sequence of characters that reads the same backwards and forwards. Given a string, s, find the longest palindromic substring in s.
Example:
Input: "banana"
Output: "anana"
Input: "million"
Output: "illi"
class Solution:
def longestPalindrome(self, s):
# Fill this in.
# Test program
s = "tracecars"
print(str(Solution().longestPalindrome(s)))
# racecar
![Subscribe to Feed Burner Subscribe to Feed Burner](/images/form/rss.gif)
Related Articles
- [Daily Problem] Witness of The Tall People
- Algorithm Interview: String Compression
- Algorithm Interview: Lowest Common Ancestor of 2 Nodes in Binary Tree
- Algorithm Interview Question: Find the Single Element in an Array of Duplicates
- Daily Interview Problem: Product of Array Except Self
- Sorting a list with 3 unique numbers
- Binary Tree Level with Minimum Sum
- Algorithm Interview: Determine If Linked List is Palindrome
- PHP Unit Tests on VPS Server
- Daily Interview Problem: Find the Number of Islands
©2006~2024 SteakOverCooked - 0.01422 Seconds(s) - 1234.456 KB/s - 13 Online
Memory: 493.19 KB
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
How to Cook a Perfect Steak? | <meta name="robots" content="noindex, follow" />
![](/images/top.jpg)
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !