script.kidd's blog

By script.kidd, 4 months ago, In English

Problem: Given an array of length $$$n$$$, find the number of increasing subsequences of length $$$k$$$, modulo $$$10^{9} + 7$$$.

I know that it can be done via the following DP, which can be optimized to $$$\mathcal O(nklogn)$$$ using a BIT or segment tree:

$$$\displaystyle dp(i, k, x) = dp(i-1, k, x) + \sum_{y < x} {dp(i-1, k-1, y)} $$$

But could it be further optimized? I can't seem to find any mentions of a faster algorithm online.

Full text and comments »

  • Vote: I like it
  • +7
  • Vote: I do not like it