随笔分类 - leetcode_math
摘要:ount the number of prime numbers less than a non-negative number, n. 题目含义:要求计算小于N的所有素数的个数。素数又称质数,是只能被1和自身整数的数 思路:厄拉多塞筛法 西元前250年,希腊数学家厄拉多塞(Eeatosthese)
阅读全文
摘要: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
阅读全文
摘要:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 题目含义:这里我们要求n!末尾有多少个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:
阅读全文
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example:
阅读全文
摘要:Implement int sqrt(int x). Compute and return the square root of x. 题目题目:返回一个int数开方后的结果
阅读全文
摘要: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
阅读全文
摘要:Determine whether an integer is a palindrome. Do this without extra space. 题目含义:不要使用额外空间,判断整数是否为回文
阅读全文
摘要:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 题目含义翻转一个整数 相关题目:190. Reverse Bits
阅读全文
摘要:Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that
阅读全文
摘要:A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the
阅读全文
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example:Given n = 2, return 91. (The answer should be the
阅读全文
摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro
阅读全文
摘要:Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12,
阅读全文
摘要:Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5,
阅读全文
摘要:Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa
阅读全文
摘要:Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100". 题目含义:将两个字符串进行二进制加减法。 思路:从最后一位开始依次计算,注意进位
阅读全文
摘要:Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: Note: 求三个乘积最大,注意下负数的情况,两负*一正
阅读全文
摘要:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example,Given nums = [0, 1,
阅读全文