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

一个有关分解质因数的面试题 | 石锅拌饭 #4

Open
chunchengwei opened this issue Dec 5, 2018 · 0 comments
Open

一个有关分解质因数的面试题 | 石锅拌饭 #4

chunchengwei opened this issue Dec 5, 2018 · 0 comments

Comments

@chunchengwei
Copy link
Owner

https://chunchengwei.github.io/shua-ti/yi-ge-you-guan-fen-jie-zhi-yin-shu-de-mian-shi-ti/

问题:给定两个字符串s、m,初始长度都为1。定义两种操作:

m = s, s = 2s
s = s + m

问给定长度L时,最少要经过多次操作1和2,才能让s的长度为L。
解题思路:我们可以发现,无论执行多少个操作1和操作2都可以,

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

No branches or pull requests

1 participant