[商管] [成大100]-資結

看板Grad-ProbAsk作者 (不琳)時間14年前 (2012/01/28 22:30), 編輯推噓3(303)
留言6則, 4人參與, 最新討論串1/1
Assume there are a few characters (no more than 20) in a list. please design an algorithm to decide whether the given list is central symmetric. For example, both "abccba" and "xyzyx" are central symmetric, wbile "abbbcba" and "qeetcwteeq" are not. Input: xyzyx. Output: Yes Input : qeetcwteeq Output: No 請各位幫我看看這題吧~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 124.218.197.132

01/28 22:40, , 1F
沒限制複雜度? 暴力就先知length 再頭和尾一直內縮去比對吧
01/28 22:40, 1F

01/28 22:45, , 2F
越看越像是大一程式課的練習題..沒限制複雜度感覺是送分@@
01/28 22:45, 2F

01/28 23:15, , 3F
迴文~~
01/28 23:15, 3F

01/29 00:31, , 4F
大概就是把字串反向後再跟原本的做lcs吧
01/29 00:31, 4F

01/29 00:36, , 5F
複雜度就算暴力也事O(n) 這應該只是考程式設計能力而已
01/29 00:36, 5F

01/29 00:38, , 6F
而且題目的重點應該在於不超過20 且是list
01/29 00:38, 6F
文章代碼(AID): #1F90PvIZ (Grad-ProbAsk)