题目描述 Implement int sqrt(int x). Compute and return the square root of x. 代码 public static int mySqrt(int x) { …
分类:LeetCode题目解答
859. Buddy Strings
Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so tha…
[Leetcode] Evaluate Division 计算除法
Evaluate Division 原文请访问:https://yanjia.me/zh/2018/12/… Equations are given in the format A / B = k, wher…
[LeetCode] Single Number II 单独的数字之二
Given an array of integers, every element appears three times except for one. Find that singl…
[LeetCode] Number of Digit One 数字1的个数,Number of 1 Bits 位1的个数
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than …
[LeetCode] Shortest Word Distance II 最短单词距离之二
This is a follow up of Shortest Word Distance. The only difference is now you are given …
[LeetCode] Self Crossing 自交
You are given an array x of n positive numbers. You start at point (0,0) and moves x[0] metres to the n…
LeetCode 067 Add Binary
题目描述 Given two binary strings, return their sum (also a binary string). For example, a = “11” b = “1” Return “…
93. Restore IP Addresses
93. Restore IP Addresses 题目 Given a string containing only digits, restore it by returning all possible valid …
LeetCode | Recover Binary Search Tree
题目: Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its s…
50. Pow(x, n)
题目 Implement pow(x, n). Example 1: Input: 2.00000, 10 Output: 1024.00000 Example 2: Input: 2.10000, 3 Output: …
[LeetCode] Set Mismatch 设置不匹配
The set S originally contains numbers from 1 to n. But unfortunately, due to the data er…