[LeetCode] Perfect Number 完美数字

 We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except itself.Now,
5次阅读

[LeetCode] Smallest Good Base 最小的好基数

 For an integer n, we call k>=2 a good base of n, if all digits of n base k are 1.Now given a string representing n, you should return the sma
5次阅读

[LeetCode] Sliding Window Median 滑动窗口中位数

 Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of t
3次阅读

[LeetCode] Diameter of Binary Tree 二叉树的直径

 Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest
3次阅读

[LeetCode] 01 Matrix 零一矩阵

 Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.Example 1:&nbs
7次阅读

[LeetCode] Convert BST to Greater Tree 将二叉搜索树BST转为较大树

 Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum o
7次阅读

[LeetCode] Reverse String II 翻转字符串之二

 Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If th
5次阅读

[LeetCode] Minimum Time Difference 最短时间差

 Given a list of 24-hour clock time points in "Hour:Minutes" format, find the minimum minutes difference between any two time points in
7次阅读

[LeetCode] Encode and Decode TinyURL 编码和解码精简URL地址

 Note: This is a companion problem to the System Design problem: Design TinyURL.TinyURL is a URL shortening service where you ente
11次阅读

[LeetCode] K-diff Pairs in an Array 数组中差为K的数对

 Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff&
14次阅读