My code: import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; pu…
分类:LeetCode
[LeetCode By Go 107]507. Perfect Number
题目 We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors ex…
[LeetCode] Maximum Gap 求最大间距
Given an unsorted array, find the maximum difference between the successive elements in its sorted form…
[LeetCode] Add and Search Word - Data structure design 添加和查找单词-数据结构设计
Design a data structure that supports the following two operations: void addWord(word) bool search(word…
[LeetCode] Strobogrammatic Number II 对称数之二
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside dow…
031 Next Permutation[M]
1 题目描述 Implement next permutation, which rearranges numbers into the lexicographically next greater permutatio…
每天一题LeetCode系列(有翻译,注释~)
leetcode 是一个很有名的在线OJ,上面收集了各大IT公司的笔试面试题,非常适用于在国内找工作的程序猿,以及刚接触ACM 算法竞赛的新手练习数据结构和算法。 有兴趣可以关注这个系列(在简书上,哈哈竟然不止我一个人关…
258. Add Digits
258 – Add Digits My Submissions Question Editorial Solution Total Accepted: 101723 Total Submissions: 20…
[LeetCode] Min Stack 最小栈
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(…
[LeetCode] Partition Equal Subset Sum 相同子集和分割
Given a non-empty array containing only positive integers, find if the array can be partitioned into tw…
[LeetCode] 01 Matrix 零一矩阵
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell. The distance betw…
[LeetCode] Non-negative Integers without Consecutive Ones 非负整数不包括连续的1
Given a positive integer n, find the number of non-negative integers less than or equal to n,…