public class Solution { public bool IsPowerOfFour(int num) { return (num > 0) && ((num & (num - 1)) == 0) && ((num & 0x55555555) == num); } }
https://leetcode.com/problems/power-of-four/#/description
时间: 2024-08-07 04:00:59
public class Solution { public bool IsPowerOfFour(int num) { return (num > 0) && ((num & (num - 1)) == 0) && ((num & 0x55555555) == num); } }
https://leetcode.com/problems/power-of-four/#/description