
leetcode
文章平均质量分 66
mnhdd
这个作者很懒,什么都没留下…
展开
-
leetcode : Counting Bits
Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array. Example: For num = 5原创 2016-05-10 20:44:02 · 464 阅读 · 1 评论 -
LeetCode OJ: 9. Palindrome Number (C++)
题目:Determine whether an integer is a palindrome. Do this without extra space. 解法1、需要额外空间: 存储各位数字,逆转,换回逆转值,与原值比较 class Solution { public: int reverse(int x) { long long sum=0; lo原创 2016-06-03 17:07:09 · 486 阅读 · 1 评论 -
LeetCode 172. Factorial Trailing Zeroes(C++)
题目:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 解法1:: 分析: 对n!做质因数分解n!=2x*3y*5z*... 显然0的个数等于min(原创 2016-06-03 18:57:28 · 356 阅读 · 1 评论