leetcode题解

2024/10/18 18:24:42

Leetcode 3133. Minimum Array End

Leetcode 3133. Minimum Array End 1. 解题思路2. 代码实现 题目链接:3133. Minimum Array End 1. 解题思路 这一题由于要求所有的array当中所有的数字的与为目标值,因此目标值当中的1的位必须保证所有的数均为1,剩下的位置只需要保证有一…

Leetcode 3137. Minimum Number of Operations to Make Word K-Periodic

Leetcode 3137. Minimum Number of Operations to Make Word K-Periodic 1. 解题思路2. 代码实现 题目链接:3137. Minimum Number of Operations to Make Word K-Periodic 1. 解题思路 这一题的话我们只需要将原始的字符串按照k个字母为一组进行分组,…

Leetcode 3147. Taking Maximum Energy From the Mystic Dungeon

Leetcode 3147. Taking Maximum Energy From the Mystic Dungeon 1. 解题思路2. 代码实现 题目链接:3147. Taking Maximum Energy From the Mystic Dungeon 1. 解题思路 这一题的话我们倒序看一下以各个位置作为终点时前面各个位置作为起点时的energy各是多少&am…

Leetcode 3133. Minimum Array End

Leetcode 3133. Minimum Array End 1. 解题思路2. 代码实现 题目链接:3133. Minimum Array End 1. 解题思路 这一题由于要求所有的array当中所有的数字的与为目标值,因此目标值当中的1的位必须保证所有的数均为1,剩下的位置只需要保证有一…

Leetcode 3139. Minimum Cost to Equalize Array

Leetcode 3139. Minimum Cost to Equalize Array 1. 解题思路2. 代码实现 题目链接:3139. Minimum Cost to Equalize Array 1. 解题思路 这一题是一道hard的题目,而且看了一下答出率低的离谱,就一开始被吓到了,不过实际做了一下…

Leetcode 3128. Right Triangles

Leetcode 3128. Right Triangles 1. 解题思路2. 代码实现 题目链接:3128. Right Triangles 1. 解题思路 这一题的话对于任意一个位置,如果该位置为1,假设其所在行中1的个数 r i r_i ri​,所在列中1的个数为 c j c_j cj​&#…

Leetcode 3132. Find the Integer Added to Array II

Leetcode 3132. Find the Integer Added to Array II 1. 解题思路2. 代码实现 题目链接:3132. Find the Integer Added to Array II 1. 解题思路 这一题由于是统一增加了一个位移,然后再删除了两个元素,因此我们将两个数组进行排序&#x…

Leetcode 3117. Minimum Sum of Values by Dividing Array

Leetcode 3117. Minimum Sum of Values by Dividing Array 1. 解题思路2. 代码实现 题目链接:3117. Minimum Sum of Values by Dividing Array 1. 解题思路 这一题思路上就是一个动态规划,我们只需要考察每一个元素是否需要放在当前的group当中还是作…

Leetcode 3122. Minimum Number of Operations to Satisfy Conditions

Leetcode 3122. Minimum Number of Operations to Satisfy Conditions 1. 解题思路2. 代码实现 题目链接:3122. Minimum Number of Operations to Satisfy Conditions 1. 解题思路 这一题就是一个动态规划的思路,我们只需要对每一列取0到9的情况各自进…

Leetcode 3128. Right Triangles

Leetcode 3128. Right Triangles 1. 解题思路2. 代码实现 题目链接:3128. Right Triangles 1. 解题思路 这一题的话对于任意一个位置,如果该位置为1,假设其所在行中1的个数 r i r_i ri​,所在列中1的个数为 c j c_j cj​&#…

Leetcode 3133. Minimum Array End

Leetcode 3133. Minimum Array End 1. 解题思路2. 代码实现 题目链接:3133. Minimum Array End 1. 解题思路 这一题由于要求所有的array当中所有的数字的与为目标值,因此目标值当中的1的位必须保证所有的数均为1,剩下的位置只需要保证有一…

Leetcode 3138. Minimum Length of Anagram Concatenation

Leetcode 3138. Minimum Length of Anagram Concatenation 1. 解题思路2. 代码实现 题目链接:3138. Minimum Length of Anagram Concatenation 1. 解题思路 这一题的话我们首先统计出来所有的字母出现的频率。 然后,我们只需要从头开始重新计数一下&…

Leetcode 3139. Minimum Cost to Equalize Array

Leetcode 3139. Minimum Cost to Equalize Array 1. 解题思路2. 代码实现 题目链接:3139. Minimum Cost to Equalize Array 1. 解题思路 这一题是一道hard的题目,而且看了一下答出率低的离谱,就一开始被吓到了,不过实际做了一下…

Leetcode 3139. Minimum Cost to Equalize Array

Leetcode 3139. Minimum Cost to Equalize Array 1. 解题思路2. 代码实现 题目链接:3139. Minimum Cost to Equalize Array 1. 解题思路 这一题是一道hard的题目,而且看了一下答出率低的离谱,就一开始被吓到了,不过实际做了一下…

Leetcode 3169. Count Days Without Meetings

Leetcode 3169. Count Days Without Meetings 1. 解题思路2. 代码实现 题目链接:3169. Count Days Without Meetings 1. 解题思路 这一题的话我们只需要先对meeting的时间进行一下排序,然后不断更新当前连续开会的时间即可。当某一个会议开始时&#…

Leetcode 3138. Minimum Length of Anagram Concatenation

Leetcode 3138. Minimum Length of Anagram Concatenation 1. 解题思路2. 代码实现 题目链接:3138. Minimum Length of Anagram Concatenation 1. 解题思路 这一题的话我们首先统计出来所有的字母出现的频率。 然后,我们只需要从头开始重新计数一下&…