Sunday, May 23, 2010

smallest window of an array

Given two arrays A [1..n] and B[1..m], find the smallest window in A that co
ntains all elements of B. That is, find a pair such that A[l..k] conta
ins B[1..m]

For example, given A = 3,1,5,7,3,5,2 and B = 5,3 then the smallest window is
[3,5].

any efficient way to do that?

No comments:

Post a Comment