Find the smallest window that covers a set of words

Given a document and a query of K words, how do u find the smallest window that covers all the words at least once in that document?

2 Comments

  1. techie007 says:

    Let S1,S2,….Si be the set of strings
    1. Set K pointers, Ki initialised to first occusrance of Si
    2. Now current Ki’s forms the first solution to start with
    3. Find KNexti for each Si as the next occurance of Si from location Ki
    4. Find the shortest KNexti as KNextj , Set Kj as KNextj and check whether current Ki’s form a solution
    5. Repeat Step 3 and 4 and the smallest window found so far will be the answer

  2. RICK says:


    CheapTabletsOnline.Com. Canadian Health&Care.Special Internet Prices.No prescription online pharmacy.Best quality drugs. High quality pills. Buy drugs online

    Buy:Amoxicillin.Aricept.Advair.Prozac.Lipothin.Zocor.Female Pink Viagra.Lipitor.Ventolin.Female Cialis.Nymphomax.Buspar.Cozaar.SleepWell.Lasix.Zetia.Acomplia.Wellbutrin SR.Seroquel.Benicar….

Leave a Reply