Given a string s consisting only of letters 'a' and 'b'. In a single step you can remove one palindromic subsequence from s. Return the minimum number ...
分类:
其他好文 时间:
2020-01-29 12:53:49
阅读次数:
94
分治,考虑分治到[l,r]的区间(设$mid=(l+r)/2$),将询问分为两类:1.在左/右区间,直接递归下去;2.跨越中间,那么处理出两个数组:L[i][j]表示左区间在开头第i个位置,以数字j为结尾的上升子序列个数(不跨越mid),右区间同理(L和R的计算很简单,只需要再处理出一个L[i][j ...
分类:
其他好文 时间:
2020-01-27 14:03:38
阅读次数:
107
2020-01-03 13:29:04 问题描述: 问题求解: 经典的动态规划题目,一般来说dp题目是递推关系公式难想,但是实际代码量还是比较少的。 有尝试过dfs来做,但是由于时间复杂度是指数级别的,所以会TLE。 ...
分类:
其他好文 时间:
2020-01-03 14:20:58
阅读次数:
82
Description Description Given two strings S and T. Count the number of distinct subsequences of S which equals T. A subsequence of a string is a new s ...
分类:
其他好文 时间:
2019-12-21 22:46:20
阅读次数:
101
Motif discovery is in loose terms the problem of finding interesting patterns in sequences. motif: interest patterns/ subsequences in sequences. two w ...
分类:
其他好文 时间:
2019-12-04 01:27:26
阅读次数:
82
原题链接在这里:https://leetcode.com/problems/increasing-subsequences/ 题目: Given an integer array, your task is to find all the different possible increasing ...
分类:
其他好文 时间:
2019-11-28 10:37:13
阅读次数:
63
首先比较容易想到肯定是前k大的元素,那么我们可以先对其进行sort,如果数值一样返回下标小的(见题意),接下里处理的时候我们发现需要将一个元素下标插入到有序序列并且需要访问第几个元素是什么,那么我们可以离线处理,将所有询问存起来,每次插入一个元素的时候在对其进行查询,那么现在就变成了离线求第k大,那 ...
分类:
其他好文 时间:
2019-11-26 13:46:00
阅读次数:
69
题目链接: 题解思路:首先按数组中的下标建一棵线段树,假设原数组是a,我们用一个新数组b记录a,将b数组先按权值排序、再按下标排序,然后再用数组记录m次询问,按k从小到大排序,再对每个询问二分线段树右边界,最后把m次询问按原来的顺序排回来,最后按顺序输出答案即可。 #include<bits/std ...
分类:
其他好文 时间:
2019-11-25 15:09:10
阅读次数:
59
D2. Optimal Subsequences (Hard Version) This is the harder version of the problem. In this version, 1≤n,m≤2?105. You can hack this problem if you lock ...
分类:
其他好文 时间:
2019-11-25 00:14:02
阅读次数:
72
题目描述 Farmer John's NN cows are standing in a row, as they have a tendency to do from time to time. Each cow is labeled with a distinct integer ID numb ...
分类:
其他好文 时间:
2019-11-02 14:11:59
阅读次数:
82