示例#1
0
        public void IsPowerOfTwoTest()
        {
            var s = new Solution();

            Assert.True(s.IsPowerOfTwo(1));
            Assert.True(s.IsPowerOfTwo(16));
            Assert.False(s.IsPowerOfTwo(218));
            // Test case 1085/1108
            Assert.False(s.IsPowerOfTwo(1073741825));
            // Test case 1086/1108
            Assert.False(s.IsPowerOfTwo(2147483646));
        }
示例#2
0
        static void Main(string[] args)
        {
            Solution s = new Solution();

            Console.Write(s.IsPowerOfTwo(8));
        }