搜索结果
查询Tags标签: Deletions,共有 4条记录-
CF1699D Almost Triple Deletions 题解
可能更好的阅读体验 题目传送门 题目大意 给定一个长度为 \(n\) 的序列 \(a_1,a_2,\dots,a_n\),每次操作你可以选择相邻的两个不同的数字删去,然后剩下的部分连成一个序列。 现在求让这个序列所以值相等的前提下,序列的最长长度。 多组数据,数据组数 \(T\le 1000\) \(…
2022/7/27 23:23:16 人评论 次浏览 -
Leetcode 1653. Minimum Deletions to Make String Balanced [Python]
设置只压入字母‘b’的stack,遇到a,则看stack中是否有字母‘b’,有的话,则需要删除,则每次出stack,res+1.而在任意位置之后,无论stack有没有东西,只要之后遍历到的是‘b’而没有了‘a’或者一个字母都没有了,那么就说明遍历到的字母都满足a在前,b在后了。总之,…
2022/2/4 22:13:07 人评论 次浏览 -
1647. Minimum Deletions to Make Character Frequencies Unique
A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The frequency of a character in a string is the number o…
2021/7/21 6:05:55 人评论 次浏览 -
1647. Minimum Deletions to Make Character Frequencies Unique
A string s is called good if there are no two different characters in s that have the same frequency. Given a string s, return the minimum number of characters you need to delete to make s good. The frequency of a character in a string is the number o…
2021/7/21 6:05:55 人评论 次浏览