摘要: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa 阅读全文
posted @ 2018-05-17 05:43 轻风舞动 阅读(527) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? Credits:Speci 阅读全文
posted @ 2018-05-17 05:22 轻风舞动 阅读(431) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two. Example 1: Example 2: Example 3: 给一个整数,写一个函数来判断它是否为2的次方数。 利用计算机用的是二进制的特点,用位操作 阅读全文
posted @ 2018-05-17 04:57 轻风舞动 阅读(651) 评论(0) 推荐(0) 编辑