Question:
Given an integer n, return the number of trailing zeroes in n!.
题意是求n的阶乘后面0的个数。
Basic Solution
直接硬求n!的结果,再计算末尾0的个数,如果n过大,结果会溢出。
** Better Solution **
Complexity : O(lgn)
后缀为0的都是2和5相乘得到的
...
在list里面边查找边remove,会出错。 因为这个原因Debug了一个早上真是哭瞎。
原来是:
123for h in total_h: if attr_value_list not in h: total_h.remove(h)
但结果始终错误,跑不出分。
调用remove后,index改变了。
所以改成了如下,先把要remove的存在新的list里面,再遍历list去掉
...
Recently, I am desired to write wordpress for do some summarization. But the format and writing style keep confusing me.
Let's try Markdown this time!
There are two ways to apply Markdown in wordpres
...