摘要: The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another n 阅读全文
posted @ 2017-10-20 21:53 daniel456 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note:n is positive and will fit within the range of a 32-bi 阅读全文
posted @ 2017-10-20 21:43 daniel456 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 阅读全文
posted @ 2017-10-20 21:13 daniel456 阅读(105) 评论(0) 推荐(0) 编辑
摘要: We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself. Now, given an integer n, write 阅读全文
posted @ 2017-10-20 21:04 daniel456 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n  阅读全文
posted @ 2017-10-20 21:00 daniel456 阅读(113) 评论(0) 推荐(0) 编辑
摘要: You have a total of n coins that you want to form in a staircase shape, where every k-th row must have exactly k coins. Given n, find the total number 阅读全文
posted @ 2017-10-20 20:53 daniel456 阅读(195) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 求两个字符串的加法 阅读全文
posted @ 2017-10-20 20:42 daniel456 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer num, write a function which returns True if num is a perfect square else False. 题目含义:判断一个数能否被开方 阅读全文
posted @ 2017-10-20 20:39 daniel456 阅读(81) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of three. 题目含义:给定一个数,判断它是否是3的n次方 思路:使用换底公式 阅读全文
posted @ 2017-10-20 20:36 daniel456 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 阅读全文
posted @ 2017-10-20 20:31 daniel456 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Given an integer, write a function to determine if it is a power of two. 题目含义:判断一个数是否是2的n次方 阅读全文
posted @ 2017-10-20 20:28 daniel456 阅读(117) 评论(0) 推荐(0) 编辑
摘要: ount the number of prime numbers less than a non-negative number, n. 题目含义:要求计算小于N的所有素数的个数。素数又称质数,是只能被1和自身整数的数 思路:厄拉多塞筛法 西元前250年,希腊数学家厄拉多塞(Eeatosthese) 阅读全文
posted @ 2017-10-20 20:25 daniel456 阅读(105) 评论(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 intege 阅读全文
posted @ 2017-10-20 20:14 daniel456 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 题目含义:这里我们要求n!末尾有多少个0 思路: 阅读全文
posted @ 2017-10-20 19:49 daniel456 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 阅读全文
posted @ 2017-10-20 19:45 daniel456 阅读(111) 评论(0) 推荐(0) 编辑
摘要: Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 阅读全文
posted @ 2017-10-20 19:43 daniel456 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Implement int sqrt(int x). Compute and return the square root of x. 题目题目:返回一个int数开方后的结果 阅读全文
posted @ 2017-10-20 19:40 daniel456 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any leadin 阅读全文
posted @ 2017-10-20 19:34 daniel456 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space. 题目含义:不要使用额外空间,判断整数是否为回文 阅读全文
posted @ 2017-10-20 19:32 daniel456 阅读(89) 评论(0) 推荐(0) 编辑
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 题目含义翻转一个整数 相关题目:190. Reverse Bits 阅读全文
posted @ 2017-10-20 16:08 daniel456 阅读(83) 评论(0) 推荐(0) 编辑