08 2015 档案
摘要:Determine whether an integer is a palindrome. Do this without extra space.判断一个integer是否为回文。注意不要用额外的空间。另外,注意考虑负数。 1 public class Solution { 2 publ...
阅读全文
摘要:Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321注意考虑几个情况,x=1534236460 1534236469 -2147483647等等。写的代码有点冗长了。 1 pub...
阅读全文
摘要:Write a SQL query to find all duplicate emails in a table namedPerson.+----+---------+| Id | Email |+----+---------+| 1 | a@b.com || 2 | c@d.com |...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文