xinyu04

导航

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 阅读(330) 评论(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 阅读(15) 评论(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 阅读(17) 评论(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 阅读(16) 评论(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 阅读(20) 评论(0) 推荐(0) 编辑