标签归档:leetcode

RSS feed of leetcode

[LeetCode]Factorial Trailing Zeroes

题目描述:

Given an integer n, return the number of trailing zeroes in n!.

Note: Your solution should be in polynomial time complexity.

题目大意:

给定一个整数n,返回n!(n的阶乘)数字中的后缀0的个数。

注意:你的解法应该满足多项式时间复杂度。

解题思路:

参考博文:http://www.geeksforgeeks.org/count-trailing-zeroes-factorial-number/

朴素解法:

首先求出n!,然后计算末尾0的个数。(重复÷10 ...

继续阅读

[LeetCode]Excel Sheet Column Title

题目描述:

Given a non-zero positive integer, return its corresponding column title as appear in an Excel sheet.

For example:

    1 -> A
    2 -> B
    3 -> C
    ...
    26 -> Z
    27 -> AA
    28 -> AB 

题目大意:

给定一个正整数,返回其在Excel表格中对应的列标题 ...

继续阅读

[LeetCode]Fraction to Recurring Decimal

题目描述:

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.

If the fractional part is repeating, enclose the repeating part in parentheses.

For example,

  • Given numerator = 1, denominator = 2, return "0.5" ...

继续阅读