Re: [閒聊] 每日LeetCode

作者: wu10200512 (廷廷)   2024-02-19 19:01:50
前幾天看C考題看到一模一樣的
一行解決
非常好布林
231. Power of Two
class Solution {
public:
bool isPowerOfTwo(int n) {
return n>0 && (n & n-1)==0;
}
};
作者: JIWP (JIWP)   2024-02-19 19:08:00
考題分一下
作者: oin1104 (是oin的說)   2024-02-19 19:09:00
我這題是算他有幾個1 好像有點爛

Links booklink

Contact Us: admin [ a t ] ucptt.com