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 | 605 Views, 21105 Search Bots | 69 Words
| Browse | Archive
Tags: 每日算法, 回文数, 面试, Python, daily problem, palindrome, algorithms, twitter interview question, python, | English | Home Page | Category: Computing | 605 Views, 21105 Search Bots | 69 Words
| Browse | Archive
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 | 605 Views, 21105 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
Related Articles
- New Vulnerabilities (CVE-2016-4581) have been detected in CentOS/RHEL/CloudLinux 7
- Skip the readings, focus on problems. And use all the hints!
- [Daily Problem] Validate Balanced Parentheses
- Daily Interview Problem: Group Words that are Anagrams
- Daily Interview Problem: Find the k-th Largest Element in a List
- Daily Interview Question: Edit Distance
- Daily Interview Puzzle: Falling Dominoes
- [Daily Problem] Add two numbers as a linked list
- Delphi Dynamic Array
- Staying on a Chess Board
©2006~2024 SteakOverCooked - 0.00708 Seconds(s) - 2802.448 KB/s - 14 Online Memory: 494.73 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="index, follow">
18:54:01 up 13 days, 18:33, 2 users, load average: 0.98, 0.86, 0.73 - Server PHP Version: 7.4.33
Comments (0)
Read & Write - Normal - Mini - Post - All Comments - Statistics
Be the first one to comment this page !