- 博客(409)
- 资源 (11)
- 收藏
- 关注
原创 剑指 Offer 15. 二进制中1的个数(Medium)(JAVA)
剑指 Offer 15. 二进制中1的个数(Medium)(JAVA)题目地址: https://leetcode-cn.com/problems/er-jin-zhi-zhong-1de-ge-shu-lcof/题目描述:请实现一个函数,输入一个整数(以二进制串形式),输出该数二进制表示中 1 的个数。例如,把 9 表示成二进制是 1001,有 2 位是 1。因此,如果输入 9,则该函数输出 2。示例 1:输入:00000000000000000000000000001011输出:3
2021-06-23 09:17:28
427
原创 剑指 Offer 38. 字符串的排列(Medium)(JAVA)每日一题
剑指 Offer 38. 字符串的排列(Medium)(JAVA)题目地址: https://leetcode-cn.com/problems/zi-fu-chuan-de-pai-lie-lcof/题目描述:输入一个字符串,打印出该字符串中字符的所有排列。你可以以任意顺序返回这个字符串数组,但里面不能有重复元素。示例:输入:s = "abc"输出:["abc","acb","bac","bca","cab","cba"]限制:1 <= s 的长度 <= 8解题方法要找
2021-06-22 09:28:33
495
原创 【LeetCode】 1600. Throne Inheritance 皇位继承顺序(Medium)(JAVA)
【LeetCode】 1600. Throne Inheritance 皇位继承顺序(Medium)(JAVA)题目地址: https://leetcode.com/problems/throne-inheritance/题目描述:A kingdom consists of a king, his children, his grandchildren, and so on. Every once in a while, someone in the family dies or a child is
2021-06-20 10:12:38
512
原创 【LeetCode】232. Implement Queue using Stacks 用栈实现队列(Easy)(JAVA)每日一题
【LeetCode】232. Implement Queue using Stacks 用栈实现队列(Easy)(JAVA)题目地址: https://leetcode.com/problems/implement-queue-using-stacks/题目描述:Implement a first in first out (FIFO) queue using only two stacks. The implemented queue should support all the functions
2021-03-05 09:08:16
341
1
原创 【LeetCode】354. Russian Doll Envelopes 俄罗斯套娃信封问题(Hard)(JAVA)每日一题
【LeetCode】354. Russian Doll Envelopes 俄罗斯套娃信封问题(Hard)(JAVA)题目地址: https://leetcode.com/problems/russian-doll-envelopes/题目描述:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if an
2021-03-04 09:43:44
183
1
原创 【LeetCode】338. Counting Bits 比特位计数(Medium)(JAVA)每日一题
【LeetCode】338. Counting Bits 比特位计数(Medium)(JAVA)题目地址: https://leetcode.com/problems/counting-bits/题目描述:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1’s in their binary representation and r
2021-03-03 09:18:48
157
原创 【LeetCode】303. Range Sum Query - Immutable 区域和检索 - 数组不可变(Easy)(JAVA)
【LeetCode】303. Range Sum Query - Immutable 区域和检索 - 数组不可变(Easy)(JAVA)题目地址: https://leetcode.com/problems/range-sum-query-immutable/题目描述:Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.Implement the&nb
2021-03-01 08:59:10
193
原创 【LeetCode】867. Transpose Matrix 转置矩阵(Easy)(JAVA)
【LeetCode】867. Transpose Matrix 转置矩阵(Easy)(JAVA)题目地址: https://leetcode.com/problems/transpose-matrix/题目描述:Given a 2D integer array matrix, return the transpose of matrix.The transpose of a matrix is the matrix flipped over its main diagonal, switching
2021-02-25 09:01:32
331
原创 【LeetCode】832. Flipping an Image 翻转图像(Easy)(JAVA)
【LeetCode】832. Flipping an Image 翻转图像(Easy)(JAVA)题目地址: https://leetcode.com/problems/perfect-squares/题目描述:Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.To flip an image horizontally mean
2021-02-24 11:53:44
156
原创 【LeetCode】1052. Grumpy Bookstore Owner 爱生气的书店老板(Medium)(JAVA)
【LeetCode】1052. Grumpy Bookstore Owner 爱生气的书店老板(Medium)(JAVA)题目地址: https://leetcode.com/problems/grumpy-bookstore-owner/题目描述:Today, the bookstore owner has a store open for customers.length minutes. Every minute, some number of customers (customer
2021-02-23 09:09:33
240
原创 【LeetCode】766. Toeplitz Matrix 托普利茨矩阵(Easy)(JAVA)
【LeetCode】766. Toeplitz Matrix 托普利茨矩阵(Easy)(JAVA)题目地址: https://leetcode.com/problems/toeplitz-matrix/题目描述:Given an m x n matrix, return true if the matrix is Toeplitz. Otherwise, return false.A matrix is Toeplitz if every diagonal from top-le
2021-02-22 09:05:41
341
原创 【LeetCode】697. Degree of an Array 数组的度(Easy)(JAVA)
【LeetCode】697. Degree of an Array 数组的度(Easy)(JAVA)题目地址: https://leetcode.com/problems/degree-of-an-array/题目描述:Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one of its elements.
2021-02-20 09:00:04
234
原创 【LeetCode】1004. Max Consecutive Ones III 最大连续1的个数 III(Medium)(JAVA)
【LeetCode】1004. Max Consecutive Ones III 最大连续1的个数 III(Medium)(JAVA)题目地址: https://leetcode.com/problems/max-consecutive-ones-iii/题目描述:Given an array A of 0s and 1s, we may change up to K values from 0 to 1.Return the length of the longest (contiguous) s
2021-02-19 09:33:58
213
1
原创 【LeetCode】1631. Path With Minimum Effort 最小体力消耗路径(Medium)(JAVA)每日一题
【LeetCode】1631. Path With Minimum Effort 最小体力消耗路径(Medium)(JAVA)题目描述:You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x columns, where heights[row][col] represents the height of cell (row, col). You are situat
2021-01-29 09:43:05
240
原创 【LeetCode】724. Find Pivot Index 寻找数组的中心索引(Easy)(JAVA)每日一题
【LeetCode】724. Find Pivot Index 寻找数组的中心索引(Easy)(JAVA)题目地址: https://leetcode.com/problems/find-pivot-index/题目描述:Given an array of integers nums, write a method that returns the “pivot” index of this array.We define the pivot index as the index where the
2021-01-28 09:11:06
193
1
原创 【LeetCode】1128. Number of Equivalent Domino Pairs 等价多米诺骨牌对的数量(Easy)(JAVA)每日一题
【LeetCode】1128. Number of Equivalent Domino Pairs 等价多米诺骨牌对的数量(Easy)(JAVA)题目地址: https://leetcode.com/problems/number-of-equivalent-domino-pairs/题目描述:Given a list of dominoes, dominoes[i] = [a, b] is equivalent to dominoes[j] = [c, d] if and only if eithe
2021-01-26 09:21:44
188
原创 【LeetCode】989. Add to Array-Form of Integer 数组形式的整数加法(Easy)(JAVA)每日一题
【LeetCode】989. Add to Array-Form of Integer 数组形式的整数加法(Easy)(JAVA)题目地址: https://leetcode.com/problems/add-to-array-form-of-integer/题目描述:For a non-negative integer X, the array-form of X is an array of its digits in left to right order. Fo
2021-01-22 08:49:37
251
原创 【LeetCode】628. Maximum Product of Three Numbers 三个数的最大乘积(Easy)(JAVA)每日一题
【LeetCode】628. Maximum Product of Three Numbers 三个数的最大乘积(Easy)(JAVA)题目地址: https://leetcode.com/problems/maximum-product-of-three-numbers/题目描述:Given an integer array nums, find three numbers whose product is maximum and return the maximum product.Exampl
2021-01-20 09:05:07
162
原创 【LeetCode】947. Most Stones Removed with Same Row or Column 移除最多的同行或同列石头(Medium)(JAVA)每日一题
【LeetCode】947. Most Stones Removed with Same Row or Column 移除最多的同行或同列石头(Medium)(JAVA)题目地址: https://leetcode.com/problems/minimum-increment-to-make-array-unique/题目描述:On a 2D plane, we place n stones at some integer coordinate points. Each coordinate poin
2021-01-15 09:24:05
191
原创 【LeetCode】1018. Binary Prefix Divisible By 5 可被 5 整除的二进制前缀(Easy)(JAVA)每日一题
【LeetCode】1018. Binary Prefix Divisible By 5 可被 5 整除的二进制前缀(Easy)(JAVA)题目地址: https://leetcode.com/problems/binary-prefix-divisible-by-5/题目描述:Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted as a binar
2021-01-14 08:50:38
156
原创 【LeetCode】684. Redundant Connection 冗余连接(Medium)(JAVA)每日一题
【LeetCode】684. Redundant Connection 冗余连接(Medium)(JAVA)题目地址: https://leetcode.com/problems/redundant-connection/题目描述:In this problem, a tree is an undirected graph that is connected and has no cycles.The given input is a graph that started as a tree wit
2021-01-13 09:08:19
521
原创 【LeetCode】1203. Sort Items by Groups Respecting Dependencies 项目管理(Hard)(JAVA)每日一题
【LeetCode】1203. Sort Items by Groups Respecting Dependencies 项目管理(Hard)(JAVA)题目地址: https://leetcode.com/problems/sort-items-by-groups-respecting-dependencies/题目描述:There are n items each belonging to zero or one of m groups where
2021-01-12 08:57:56
343
原创 【LeetCode】1202. Smallest String With Swaps 交换字符串中的元素(Medium)(JAVA)每日一题
【LeetCode】1202. Smallest String With Swaps 交换字符串中的元素(Medium)(JAVA)题目地址: https://leetcode.com/problems/smallest-string-with-swaps/题目描述:You are given a string s, and an array of pairs of indices in the string pairs where pairs[i] = [a,
2021-01-11 09:27:54
282
原创 【LeetCode】228. Summary Ranges 汇总区间(Easy)(JAVA)每日一题
【LeetCode】228. Summary Ranges 汇总区间(Easy)(JAVA)题目地址: https://leetcode.com/problems/summary-ranges/题目描述:You are given a sorted unique integer array nums.Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, e
2021-01-10 10:38:16
146
原创 【LeetCode】123. Best Time to Buy and Sell Stock III 买卖股票的最佳时机 III(Hard)(JAVA)每日一题
【LeetCode】123. Best Time to Buy and Sell Stock III 买卖股票的最佳时机 III(Hard)(JAVA)题目地址: https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/题目描述:Say you have an array for which the ith element is the price of a given stock on day i.Design an al
2021-01-09 09:01:48
219
原创 【LeetCode】189. Rotate Array 旋转数组(Medium)(JAVA)每日一题
【LeetCode】189. Rotate Array 旋转数组(Medium)(JAVA)题目地址: https://leetcode.com/problems/rotate-array/题目描述:Given an array, rotate the array to the right by k steps, where k is non-negative.Follow up:Try to come up as many solutions as you can, the
2021-01-08 09:06:04
129
原创 【LeetCode】547. Number of Provinces 省份数量(Medium)(JAVA)每日一题
【LeetCode】547. Number of Provinces 省份数量(Medium)(JAVA)题目地址: https://leetcode.com/problems/number-of-provinces/题目描述:There are n cities. Some of them are connected, while some are not. If city a is connected directly with city b, and city b is connected di
2021-01-07 09:01:24
474
1
原创 【LeetCode】399. Evaluate Division 除法求值(Medium)(JAVA)每日一题
【LeetCode】399. Evaluate Division 除法求值(Medium)(JAVA)题目地址: https://leetcode.com/problems/evaluate-division/题目描述:You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [A_i, B_i] and values[i] represent
2021-01-06 09:48:33
226
原创 【LeetCode】830. Positions of Large Groups 较大分组的位置(Easy)(JAVA)每日一题
【LeetCode】830. Positions of Large Groups 较大分组的位置(Easy)(JAVA)题目地址: https://leetcode.com/problems/positions-of-large-groups/题目描述:In a string s of lowercase letters, these letters form consecutive groups of the same character.For example, a string li
2021-01-05 08:55:26
999
原创 【LeetCode】509. Fibonacci Number 斐波那契数(Easy)(JAVA)每日一题
【LeetCode】509. Fibonacci Number 斐波那契数(Easy)(JAVA)题目地址: https://leetcode.com/problems/fibonacci-number/题目描述:The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding
2021-01-04 08:42:38
186
原创 【LeetCode】86. Partition List 分隔链表(Medium)(JAVA)每日一题
【LeetCode】86. Partition List 分隔链表(Medium)(JAVA)题目地址: https://leetcode.com/problems/partition-list/题目描述:Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the
2021-01-03 10:55:18
144
原创 【LeetCode】239. Sliding Window Maximum 滑动窗口最大值(Hard)(JAVA)每日一题
【LeetCode】239. Sliding Window Maximum 滑动窗口最大值(Hard)(JAVA)题目地址: https://leetcode.com/problems/sliding-window-maximum/题目描述:You are given an array of integers nums, there is a sliding window of size k which is moving from the very left of the array to
2021-01-02 09:57:25
156
原创 【LeetCode】605. Can Place Flowers 种花问题(Easy)(JAVA)每日一题
【LeetCode】605. Can Place Flowers 种花问题(Easy)(JAVA)题目地址: https://leetcode.com/problems/can-place-flowers/题目描述:You have a long flowerbed in which some of the plots are planted, and some are not. However, flowers cannot be planted in adjacent plots.Given a
2021-01-01 09:45:48
259
原创 【LeetCode】435. Non-overlapping Intervals 无重叠区间(Medium)(JAVA)每日一题
【LeetCode】435. Non-overlapping Intervals 无重叠区间(Medium)(JAVA)题目地址: https://leetcode.com/problems/non-overlapping-intervals/题目描述:Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non
2020-12-31 10:17:56
169
原创 【LeetCode】1046. Last Stone Weight 最后一块石头的重量(Easy)(JAVA)每日一题
【LeetCode】1046. Last Stone Weight 最后一块石头的重量(Easy)(JAVA)题目地址: https://leetcode.com/problems/last-stone-weight/题目描述:We have a collection of stones, each stone has a positive integer weight.Each turn, we choose the two heaviest stones and s
2020-12-30 10:06:00
186
原创 【LeetCode】390. Elimination Game 消除游戏(Medium)(JAVA)
【LeetCode】390. Elimination Game 消除游戏(Medium)(JAVA)题目地址: https://leetcode.com/problems/elimination-game/题目描述:There is a list of sorted integers from 1 to n. Starting from left to right, remove the first number and every other number afterward until you r
2020-12-29 09:23:13
171
原创 【LeetCode】389. Find the Difference 找不同(Easy)(JAVA)
【LeetCode】389. Find the Difference 找不同(Easy)(JAVA)题目地址: https://leetcode-cn.com/problems/find-the-difference/题目描述:You are given two strings s and t.String t is generated by random shuffling string s and then add one more letter at a random position.Re
2020-12-29 09:22:40
173
原创 【LeetCode】388. Longest Absolute File Path 文件的最长绝对路径(Medium)(JAVA)
【LeetCode】388. Longest Absolute File Path 文件的最长绝对路径(Medium)(JAVA)题目地址: https://leetcode.com/problems/longest-absolute-file-path/题目描述:Suppose we have a file system that stores both files and directories. An example of one system is represented in the fol
2020-12-29 09:21:39
209
原创 【LeetCode】387. First Unique Character in a String 字符串中的第一个唯一字符(Easy)(JAVA)
【LeetCode】387. First Unique Character in a String 字符串中的第一个唯一字符(Easy)(JAVA)题目地址: https://leetcode.com/problems/first-unique-character-in-a-string/题目描述:Given a string, find the first non-repeating character in it and return its index. If it doesn’t exist,
2020-12-29 09:20:57
137
原创 【LeetCode】386. Lexicographical Numbers 字典序排数(Medium)(JAVA)
【LeetCode】386. Lexicographical Numbers 字典序排数(Medium)(JAVA)题目地址: https://leetcode.com/problems/lexicographical-numbers/题目描述:Given an integer n, return 1 - n in lexicographical order.For example, given 13, return: [1,10,11,12,13,2,3,4,5,6,7,8,9].Please
2020-12-29 09:20:21
140
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人