随笔分类 - leetcode_math
摘要:1 /** 2 * 两个大数相减,默认没有符号位,且都为正数 3 * 4 * @param a 5 * @param b 6 * @return 7 */ 8 public static String bigDigitalSub(String a, String b) { 9 //翻转字符串并...
阅读全文
摘要:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai
阅读全文
摘要:Given a positive integer n and you can do operations as follow: What is the minimum number of replacements needed for n to become 1? 含义:给定一个正数n,如果n是偶数
阅读全文
摘要:Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, return fa
阅读全文
摘要:Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l
阅读全文
摘要:Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT. 题目含义:不要使用乘 除 取模,计算除法 方法一:
阅读全文
摘要:Implement pow(x, n). 题目含义:实现x的n次方
阅读全文
摘要:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating
阅读全文
摘要:TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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:
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. Note: 求两个字符串的加法
阅读全文
摘要:Given a positive integer num, write a function which returns True if num is a perfect square else False. 题目含义:判断一个数能否被开方
阅读全文
摘要:Given an integer, write a function to determine if it is a power of three. 题目含义:给定一个数,判断它是否是3的n次方 思路:使用换底公式
阅读全文
摘要: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:
阅读全文
摘要:Given an integer, write a function to determine if it is a power of two. 题目含义:判断一个数是否是2的n次方
阅读全文