
leetcode
文章平均质量分 81
codefreestyle
这个作者很懒,什么都没留下…
展开
-
2290. Minimum Obstacle Removal to Reach Corner
文章目录解题代码解题思路英文题目链接中文题目链接You are given a 0-indexed 2D integer array grid of size m x n. Each cell has one of two values:0 represents an empty cell,1 represents an obstacle that may be removed.You can move up, down, left, or right from and to an empty原创 2022-05-29 17:52:04 · 306 阅读 · 0 评论 -
数据结构与算法:单调栈(monotonic stack)
文章目录背景小窍门LeftBigger例子代码LeftSmaller例子代码RightBigger例子代码RightSmaller例子代码测试LeetCode题目背景我们经常会遇到这种类型的问题:给定一个数组,针对数组中每个元素,找出其左边第一个比它大的数(LeftBigger);给定一个数组,针对数组中每个元素,找出其左边第一个比它小的数(LeftSmaller);给定一个数组,针对数组中每个元素,找出其右边第一个比它大的数(RightBigger);给定一个数组,针对数组中每个元素,找出其原创 2022-05-29 17:32:47 · 722 阅读 · 1 评论 -
# 329. Longest Increasing Path in a Matrix
文章目录329. Longest Increasing Path in a Matrix解题代码解题思路329. Longest Increasing Path in a Matrix英文题目链接中文题目链接Given an m x n integers matrix, return the length of the longest increasing path in matrix.From each cell, you can either move in four directions:原创 2022-05-19 10:30:09 · 313 阅读 · 0 评论 -
672. Bulb Switcher II
题目链接英文题目中文题目题目There is a room with n lights which are turned on initially and 4 buttons on the wall. After performing exactly m unknown operations towards buttons, you need to return how many different kinds of status of the n lights could be.Suppose原创 2020-09-07 22:10:26 · 114 阅读 · 0 评论 -
Leetcode 319 Bulb Switcher
题目描述英文题目中文题目题目There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the i-th round, you t原创 2020-09-06 22:18:36 · 136 阅读 · 0 评论 -
Leetcode 740. Delete and Earn
题目英文题目链接中文题目链接描述Given an array nums of integers, you can perform operations on the array.In each operation, you pick any nums[i] and delete it to earn nums[i] points. After, you must delete every element equal to nums[i] - 1 or nums[i] + 1.You start原创 2020-07-25 18:21:53 · 103 阅读 · 0 评论 -
Leetcode 486. Predict the Winner
题目传送门英文题目地址中文题目地址题目描述Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each time a player picks a number, that number will not b原创 2020-07-24 00:23:04 · 130 阅读 · 0 评论 -
leetcode 474. Ones and Zeroes
题目链接:Ones and Zeroes英文题目In the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue.For now, suppose you are a dominator of m 0s and n 1s...原创 2019-06-16 17:07:14 · 143 阅读 · 0 评论 -
二分总结
数组旋转(数字无重复):153. Find Minimum in Rotated Sorted Array能用二分法特点:数组有一个不可导的最小值,最小值两边的数字都是有序的数组旋转(数字有重复):154. Find Minimum in Rotated Sorted Array II不能用二分法未完待续…...原创 2019-05-15 10:47:43 · 130 阅读 · 0 评论