title: Minimum window width in string x that contains all characters of string y
body: <p>Find minimum window width in string <code>x</code> that contains all characters of another string <code>y</code>. For example:</p>
  
  <pre><code>String x = "coobdafceeaxab"
  String y = "abc"
  </code></pre>
  
  <p>The answer should be 5, because the shortest substring in <code>x</code> that contains all three letters of <code>y</code> is "bdafc".</p>
  
  <p>I can think of a naive solution with complexity <code>O(n^2 * log(m))</code>, where <code>n = len(x)</code> and <code>m = len(y)</code>. Can anyone suggest a better solution? Thanks.</p>
  
  <p><strong>Update</strong>: now think of it, if I change my set to <code>tr1::unordered_map</code>, then I can cut the complexity down to <code>O(n^2)</code>, because insertion and deletion should both be <code>O(1)</code>.</p>