摘要:
Related to question Excel Sheet Column TitleGiven a column title as appear in an Excel sheet, return its corresponding column number.For example: A... 阅读全文
posted @ 2015-03-17 18:49
hongchun_z
阅读(130)
评论(0)
推荐(0)
摘要:
Given an integern, return the number of trailing zeroes inn!.Note:Your solution should be in logarithmic time complexity.解析: 只有2和5相乘才会出现0,其中整十也可以看做是2和... 阅读全文
posted @ 2015-03-17 18:24
hongchun_z
阅读(107)
评论(0)
推荐(0)
摘要:
Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may complet... 阅读全文
posted @ 2015-03-17 16:52
hongchun_z
阅读(147)
评论(0)
推荐(0)
摘要:
Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:... 阅读全文
posted @ 2015-03-17 16:11
hongchun_z
阅读(128)
评论(0)
推荐(0)
摘要:
//bit_reverse:32位数按位反转函数//作用:把一个32位整数按位反转,即第1位转到第32位,第2位转到第31位,依次下去。//算法实现:第一行代码为奇偶位相互交换;第二行为以两位为一单元,奇偶单元进行交换;第三行为以四位为一单元,奇偶单元进行交换;第四行为以八位为一单元,奇偶单元进行... 阅读全文
posted @ 2015-03-17 15:51
hongchun_z
阅读(176)
评论(0)
推荐(0)
摘要:
C语言 统计整数二进制表示中1的个数(转载)这是一个很有意思的问题,也是在面试中最容易被问到的问题之一。这个问题有个正式的名字叫Hamming_weight,而且wikipedia上也提供了很好的位运算解决的方法,这个下面也会提到。解决这个问题的第一想法是一位一位的观察,判断是否为1,是则计数器加一... 阅读全文
posted @ 2015-03-17 15:01
hongchun_z
阅读(559)
评论(0)
推荐(0)

浙公网安备 33010602011771号