[問題] LeetCode 最長回文子字串

作者: ken1325 (優質水瓶男)   2017-12-09 23:57:38
LeetCode 5. Longest Palindromic Substring
https://leetcode.com/problems/longest-palindromic-substring/description/
Given a string s, find the longest palindromic substring in s. You may assume
that the maximum length of s is 1000.
這題要在一個字串裡面找出最長的子字串
https://paste.ofcode.org/WpkzvXdgCx2zXJGhULWYtm
這是我用暴力法寫的,但是submit後他說有 Wrong Answer
我不知道錯在哪裡
有人能幫我看看嗎?
感謝
作者: ckc1ark (偽物)   2017-12-10 00:04:00
try "ab"
作者: ken1325 (優質水瓶男)   2017-12-10 00:09:00
喔喔,感謝。
作者: alan23273850   2017-12-11 11:41:00
如果是leetcode的話應該要用dp吧?
作者: suhorng ( )   2017-12-12 07:07:00
中心擴展法是暴力法吧
作者: oToToT (屁孩)   2017-12-13 16:44:00
他的暴力大概是直接拆下來後字串比較吧

Links booklink

Contact Us: admin [ a t ] ucptt.com