title: Algorithm to find minimum length in main string to find second string
body: <p>There is a one question of Algorithm.</p>
  
  <p><strong>Question is as follows:-</strong></p>
  
  <p>You are given a protein String consisting of characters, A, B, C, D. You have to find a minimum length sequence in that.</p>
  
  <p><strong>Example</strong></p>
  
  <pre><code>0 1 2 3 4 5 6 7 8 9 10 11 12
  A B A C D C A B C D  C  C  D  
  
  String to find is : BCD 
  
  This string is find between (StartPoint, EndPoint)
  1, 4
  7, 9
  1, 12
  7, 12
  
  Minimum length is of 7, 9.
  
  So the answer is 7, 9
  </code></pre>
  
  <p><strong>My work,</strong></p>
  
  <ol>
  <li>We can solve this using Brute force approach in O(n^2).</li>
  <li>We can find the first sequence present in main string by using DP, and my DP logic is as follows, </li>
  </ol>
  
  <blockquote>
  <pre><code>A = Main string
  B = String to be find
  DP = Dynamic programming function
  
  n = A.size, m = B.size
  
  Build an array of  DP[m+1][n+1]
  
  DP[i][j], means If in A[0...i], B[0...j] is present or not.
  
  This way we can find our first occurence of B in A. Now after this, I am stuck.
  </code></pre>
  </blockquote>
  
  <p>I need some hint from your side.</p>
  
  <p><strong>Please give me hint/guidance only, no code or implementation required.</strong></p>