摘要:
Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include2, 3, 5. For examp... 阅读全文
摘要:
Given an integer, write a function to determine if it is a power of two.Java code:(两种方法,第二种方法很妙,用到了bit wise )第二种方法解题思路:如果一个整数是2的幂,那么它的二进制形式最高位为1,其余各位为... 阅读全文
摘要:
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Have you thought about this?Here are some good questions to ask... 阅读全文
摘要:
Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文
摘要:
Question:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.简单介绍一下罗马数字,摘自维基百科罗马数字共有7个,即I(1)、V(5... 阅读全文