title: how do I understand the specific solution to one problem in hackerrank？
body: <p>It's about a solution to one problem in hackerrand. please click the link:</p>
  
  <p><a href="https://www.hackerrank.com/challenges/reverse-shuffle-merge" rel="nofollow noreferrer">the link of problem description</a></p>
  
  <pre><code>string reverseShuffleMerge(string s) {
  int n = s.length();
  vector&lt;char&gt; sarr(s.rbegin(), s.rend());
  int alpha_size = 26;
  vector&lt;int&gt; freq(alpha_size, 0);
  for (int i = 0; i &lt; n; i++) {
      freq[sarr[i] - 'a']++;
  }
  vector&lt;int&gt; did_use(alpha_size, 0);
  vector&lt;int&gt; can_use(freq.begin(), freq.end());
  vector&lt;char&gt; A;
  for (int i = 0; i &lt; n; i++) {
      if (did_use[sarr[i] - 'a'] &lt; freq[sarr[i] - 'a'] / 2) {
          while (A.size() &gt; 0 &amp;&amp; sarr[i] &lt; A.back() 
                 &amp;&amp; did_use[A.back() - 'a'] + can_use[A.back() - 'a'] - 1 
                 &gt;= freq[A.back() - 'a'] / 2) {
              did_use[A.back() - 'a']--;
              A.pop_back();
          }
          A.push_back(sarr[i]);
          did_use[sarr[i] - 'a']++;
          can_use[sarr[i] - 'a']--;
      } else {
          can_use[sarr[i] - 'a']--;
      }
  }
  return string(A.begin(), A.end());
  </code></pre>
  
  <p>}</p>
  
  <p>I don't get the point of this line: did_use[A.back() - 'a'] + can_use[A.back() - 'a'] - 1 >= freq[A.back() - 'a'] / 2</p>
  
  <p>Could anyone help to shed some light on what part this line plays in the solution?</p>