<p>You are given an integer array <code>nums</code> of length <code>n</code> which represents a permutation of all the integers in the range <code>[0, n - 1]</code>.</p>
<p>The number of <strong>global inversions</strong> is the number of the different pairs <code>(i, j)</code> where:</p>
<ul>
<li><code>0 <= i < j < n</code></li>
<li><code>nums[i] > nums[j]</code></li>
</ul>
<p>The number of <strong>local inversions</strong> is the number of indices <code>i</code> where:</p>
<ul>
<li><code>0 <= i < n - 1</code></li>
<li><code>nums[i] > nums[i + 1]</code></li>
</ul>
<p>Return <code>true</code><em>if the number of <strong>global inversions</strong> is equal to the number of <strong>local inversions</strong></em>.</p>