i think we don't need to store the total no. of occurance of any character. we can think of it as a classic knapSack, We have n ( size of the string) items, does'nt matter if they repeat or not . We don't have to keep a track how many of a char we have used as we have only options in this array , just take every index item as different item, that will automatcally do this.
On Wed, Dec 29, 2010 at 4:46 PM, juver++ <[email protected]> wrote: > It's a knapsack problem with bounds. Solve it using DP - for each state > keep number of used characters and preserve to exceed the bounds. > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
