title: How to find the maximum value of pairs a string could have?
body: <p>You are given two s: N and K. Lun the dog is interested in strings that satisfy the following conditions: </p>
  
  <ul>
  <li>The string has exactly N characters, each of which is either 'A' or 'B'. </li>
  <li>The string s could have K pairs (i, j) (0 &lt;= i &lt; j &lt;= N-1) such that s[i] = 'A' and s[j] = 'B'. </li>
  </ul>
  
  <p>What's the maximum value of K a string of N characters could have?</p>