<p>You are given a <strong>0-indexed</strong> array of positive integers <code>tasks</code>, representing tasks that need to be completed <strong>in order</strong>, where <code>tasks[i]</code> represents the <strong>type</strong> of the <code>i<sup>th</sup></code> task.</p>
<p>You are also given a positive integer <code>space</code>, which represents the <strong>minimum</strong> number of days that must pass <strong>after</strong> the completion of a task before another task of the <strong>same</strong> type can be performed.</p>
<p>Each day, until all tasks have been completed, you must either:</p>
<ul>
<li>Complete the next task from <code>tasks</code>, or</li>
<li>Take a break.</li>
</ul>
<p>Return<em> the <strong>minimum</strong> number of days needed to complete all tasks</em>.</p>