摘要: Given an integer, write a function to determine if it is a power of two.判断一个integer是否为2的幂。 1 public class Solution { 2 public static boolean isPow... 阅读全文
posted @ 2015-08-06 10:39 codingcat 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer... 阅读全文
posted @ 2015-08-06 10:16 codingcat 阅读(250) 评论(0) 推荐(0) 编辑
摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2015-08-06 09:48 codingcat 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming weight).For example, the 32-bit in... 阅读全文
posted @ 2015-08-06 09:28 codingcat 阅读(121) 评论(0) 推荐(0) 编辑