Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

回文串构成的第二种情况定义有误 #665

Closed
heibai23 opened this issue Mar 3, 2020 · 3 comments
Closed

回文串构成的第二种情况定义有误 #665

heibai23 opened this issue Mar 3, 2020 · 3 comments
Labels
bug Content error

Comments

@heibai23
Copy link

heibai23 commented Mar 3, 2020

  • 位置:算法-几道常见的子符串算法题-4.1
  • 内容:字符出现次数为双数的组合+一个只出现一次的字符
  • 有误点:只出现一次有误,因为也可以是出现三次、五次
    • 例子:aabbcccd,此时最长应为 abcccba,c出现为三次
  • 个人见解:应该为字符出现次数为偶数的组合+单个字符中出现次数最多且为奇数次的字符
@timmmGZ
Copy link

timmmGZ commented Mar 4, 2020

同意

@Snailclimb
Copy link
Owner

  • 位置:算法-几道常见的子符串算法题-4.1

  • 内容:字符出现次数为双数的组合+一个只出现一次的字符

  • 有误点:只出现一次有误,因为也可以是出现三次、五次

    • 例子:aabbcccd,此时最长应为 abcccba,c出现为三次
  • 个人见解:应该为字符出现次数为偶数的组合+单个字符中出现次数最多且为奇数次的字符

已经更改,感谢老哥!

@Snailclimb Snailclimb added the bug Content error label Mar 18, 2020
@orekiJY
Copy link

orekiJY commented Sep 19, 2023

还是有问题...
依照题意,即使某个字符出现总次数为奇数2n+1,也可以使用其中的2n个字符来组成对称字符串
无论字符是否出现最多次,都应该尽可能用上该字符,最后再根据是否存在奇数+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Content error
Projects
None yet
Development

No branches or pull requests

4 participants