Let ways[n][k][prev] denote the number of ways of selecting a sequence of
size K, where n is the current index,k is the size,prev is the previous
chosen element in the sequence.
then
ways[n][k][prev]=ways[n][k][prev]+ways[n-1][k][prev],
if a[n]>=a[prev]
ways[n][k][prev]=ways[n][k][prev]+ways[
What do you mean by longest when size is given as K?
On Thu, Aug 25, 2011 at 6:11 PM, WgpShashank wrote:
> *Hey Geeks, Sharing an Interesting Question here "Given an array of
> integers (+ive,-ive & 0 as well) , you have to tell number of ways you can
> select longest increasing sub-sequences o
*Hey Geeks, Sharing an Interesting Question here "Given an array of
integers (+ive,-ive & 0 as well) , you have to tell number of ways you can
select longest increasing sub-sequences of size k where k<=n(size of array)
from that array , also print those sub-sequences.
*
example 1 4 6 2 5 &