不为成仙,只为在这红尘中等你回来。

453. Minimum Moves to Equal Array Elements [Easy] [Math]

    ### 题意 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 - 1 elements by 1. 给定一个长度为 n 的非空整数数组,找到让数组所有元素相等的最小移动次数。每次移动可以使 n - 1 个元素增加 1。 Exam...

    阅读全文>>

2018年5月2日 23:07 作者:nancy 分类:[LeetCode] 1286

441. Arranging Coins [Easy] [Math]

    ### 题意 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. 你总共有 n 枚硬币,你需要将它们摆成一个阶梯形状,第 k 行就必须正好有 k 枚硬币。 Given n, find the total number of full staircase rows that can be fo...

    阅读全文>>

2018年4月30日 21:49 作者:nancy 分类:[LeetCode] 1369

415. Add Strings [Easy] [Math]

    ### 题意 Given two non-negative integers num1 and num2 represented as string, return the sum of num1 and num2. 给定两个字符串形式的非负整数 num1 和 num2 ,计算它们的和。 ```python Note: 1.The length of both num1 and num2 is < 5100. 1.num1 和 num2 的长度都小于 5100。...

    阅读全文>>

2018年4月30日 14:48 作者:nancy 分类:[LeetCode] 1258

400. Nth Digit [Easy] [Math]

    ### 题意 Find the `n**th` digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... 在无限的整数序列 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...中找到第 n 个数字。 Note: n is positive and will fit within the range of a 32-bit signed integer...

    阅读全文>>

2018年4月30日 13:44 作者:nancy 分类:[LeetCode] 1290

367. Valid Perfect Square [Easy] [Math]

    ### 题意 Given a positive integer num, write a function which returns True if num is a perfect square else False. 给定一个正整数 num,编写一个函数,如果 num 是一个完全平方数,则返回 True,否则返回 False。 Note: Do not use any built-in library function such as sqrt. 注意:不要使用任...

    阅读全文>>

2018年4月28日 23:11 作者:nancy 分类:[LeetCode] 1254

326. Power of Three [Easy] [Math]

    ### 题意 Given an integer, write a function to determine if it is a power of three. 给出一个整数,写一个函数来确定这个数是不是3的一个幂。 Follow up: Could you do it without using any loop / recursion? 你能不使用循环或者递归完成本题吗? ### 思路 求对数,然后乘方,判断得数是否相等 ```python # ...

    阅读全文>>

2018年4月28日 21:09 作者:nancy 分类:[LeetCode] 1351

263. Ugly Number [Easy] [Math]

    ### 题意 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 example, 6, 8 are ugly while 14 is not ugly since it includes another...

    阅读全文>>

2018年4月27日 22:02 作者:nancy 分类:[LeetCode] 1335

258. Add Digits [Easy] [Math]

    ### 题意 Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. 给一个非负整数 num,反复添加所有的数字,直到结果只有一个数字。 For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one d...

    阅读全文>>

2018年4月27日 21:58 作者:nancy 分类:[LeetCode] 1280

67. Add Binary [Easy] [String]

    ### 题意   Given two binary strings, return their sum (also a binary string). 给定两个二进制字符串,返回他们的和(用二进制表示)。 The input strings are both non-empty and contains only characters 1 or 0. 输入为非空字符串且只包含数字 1 和 0。 Example 1: ```python Input: a = "...

    阅读全文>>

2018年4月13日 19:55 作者:nancy 分类:[LeetCode] 1302

13. Roman to Integer [Easy] [String]

    ### 题意 Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M. 罗马数字包含以下七种字符:I, V, X, L,C,D 和 M。 ```python Symbol Value I 1 V 5 X 10 L 50 C 100 ...

    阅读全文>>

2018年4月6日 22:01 作者:nancy 分类:[LeetCode] 1291