xinyu04

导航

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页

2022年7月22日 #

LeetCode 73 Set Matrix Zeroes 思维

摘要: Given an m x n integer matrix matrix, if an element is $0$, set its entire row and column to $0$'s. You must do it in place. Solution 做法并不难,但如果考虑常数空间复 阅读全文

posted @ 2022-07-22 06:15 Blackzxy 阅读(10) 评论(0) 推荐(0) 编辑

LeetCode 155 Min Stack

摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class: MinStack() initializes 阅读全文

posted @ 2022-07-22 02:51 Blackzxy 阅读(3) 评论(0) 推荐(0) 编辑

2022年7月21日 #

LeetCode 695 Max Area of Island DFS

摘要: You are given an m x n binary matrix grid. An island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) You may 阅读全文

posted @ 2022-07-21 16:29 Blackzxy 阅读(13) 评论(0) 推荐(0) 编辑

LeetCode 733 Flood Fill BFS模板

摘要: An image is represented by an m x n integer grid image where image[i][j] represents the pixel value of the image. You are also given three integers sr 阅读全文

posted @ 2022-07-21 15:14 Blackzxy 阅读(33) 评论(0) 推荐(0) 编辑

2022年7月20日 #

[Google] LeetCode 2158 Amount of New Area Painted Each Day 思维+set

摘要: There is a long and thin painting that can be represented by a number line. You are given a 0-indexed 2D integer array paint of length n, where paint[ 阅读全文

posted @ 2022-07-20 21:19 Blackzxy 阅读(319) 评论(0) 推荐(0) 编辑

LeetCode 567 Permutation in String Map

摘要: Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise. In other words, return true if one of s1's permutatio 阅读全文

posted @ 2022-07-20 17:08 Blackzxy 阅读(12) 评论(0) 推荐(0) 编辑

LeetCode 3 Longest Substring Without Repeating Characters

摘要: Given a string s, find the length of the longest substring without repeating characters. Solution 求最长的不重复子串。我们利用左右两个指针来模拟端点,然后用 $set$ 来记录出现过的字符。当出现重复的 阅读全文

posted @ 2022-07-20 15:43 Blackzxy 阅读(13) 评论(0) 推荐(0) 编辑

LeetCode 122 Best Time to Buy and Sell Stock II 贪心+思维

摘要: You are given an integer array prices where prices[i] is the price of a given stock on the $i$th day. On each day, you may decide to buy and/or sell t 阅读全文

posted @ 2022-07-20 05:16 Blackzxy 阅读(13) 评论(0) 推荐(0) 编辑

LeetCode 121 Best Time to Buy and Sell Stock 贪心

摘要: You are given an array prices where prices[i] is the price of a given stock on the $i$th day. You want to maximize your profit by choosing a single da 阅读全文

posted @ 2022-07-20 03:26 Blackzxy 阅读(18) 评论(0) 推荐(0) 编辑

2022年7月19日 #

LeetCode 56 Merge Intervals 排序+模板

摘要: Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals 阅读全文

posted @ 2022-07-19 21:42 Blackzxy 阅读(20) 评论(0) 推荐(0) 编辑

上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 30 下一页