Re: [閒聊] 每日LeetCode已回收
前幾天看C考題看到一模一樣的
一行解決
非常好布林
231. Power of Two
class Solution {
public:
bool isPowerOfTwo(int n) {
return n>0 && (n & n-1)==0;
}
};
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.0.229 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1708340512.A.BB7.html
推
02/19 19:08,
1年前
, 1F
02/19 19:08, 1F
→
02/19 19:09,
1年前
, 2F
02/19 19:09, 2F
討論串 (同標題文章)
完整討論串 (本文為第 695 之 719 篇):