![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 81
残阳红袖
这个作者很懒,什么都没留下…
展开
-
121.Best Time to Buy and Sell Stock
今天刷Leetcode,遇到这样一个问题。Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell on...原创 2018-02-10 18:26:07 · 154 阅读 · 0 评论 -
342. Power of Four
判断一个数是不是4的幂。First,greater than 0.Second,only have one ‘1’ bit in their binary notation,so we use x&(x-1) to delete the lowest ‘1’,and if then it becomes 0,it prove that there is only one ‘1’ bit.T...转载 2018-03-09 10:28:13 · 131 阅读 · 0 评论 -
Floyd判圈算法 leetcode 202题Happy Number
今天,日常刷leetcode,遇到202问题如下: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 t...原创 2018-03-01 18:34:28 · 456 阅读 · 0 评论 -
191. Number of 1 Bits
Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11' has binary representation 000000000000...翻译 2018-03-06 17:36:06 · 126 阅读 · 0 评论