![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
little_ppj
这个作者很懒,什么都没留下…
展开
-
string处理
1 如果是直接声明 string s="";后面不能像给char 数组赋值一样赋值,必须用+连接添加,eg:s=s+"2"; eg:leetcode 66 2 越界问题 eg:leetcode 69 int mySqrt(int x) { int i = 1; while(i*i<=x&&i!=46340)i++;//若i=46341,...原创 2018-08-23 22:50:59 · 185 阅读 · 0 评论 -
leetcode 121 best time to buy and sell stock
题目 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 one share of the stock...原创 2018-08-25 10:04:57 · 135 阅读 · 0 评论 -
190. Reverse Bits
大数的时候可以想按位与的方法,就像190题,翻转,n&1是取出最后一个数 uint32_t reverseBits(uint32_t n) { uint32_t ret = 0; int i=0; while(i<32) { ret=(ret << 1)+(n & 1); ...原创 2018-09-05 13:44:15 · 155 阅读 · 0 评论