LeetCode
hamilton-liu
假如编程易懂得,那么程序员就不会热情地写出注释,也不会有得到编程的快乐。
展开
-
203 Remove Linked List Elements
删除单链表中元素值为val的所有节点原创 2015-04-23 19:14:59 · 736 阅读 · 0 评论 -
202 Happy Number
Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares原创 2015-04-23 21:32:20 · 847 阅读 · 0 评论 -
201 Bitwise AND of Numbers Range
题目介绍:将m到n之间的所有的数相与,得到其结果要点:最笨的方法是将所有的数真正的相与,这无疑耗时效率低下。通过分析可以发现,若两个数最高有效位长度不相等,则最终结果一定是仅含n的最高有效位的值,eg. m = 0x1kkk, n = 0x1kkk kkkk,k代表0或1,最终m到n所有数相与的结果为0x10000 0000;若两个数最高有效位长度相等,则从高位依次比较其相等的位,直到不相等为止,相等的位保留,不相等的位置为0,则为与之后的结果,eg. m = 0x1010 0100, n = 0x原创 2015-04-24 14:18:39 · 821 阅读 · 0 评论