Complete proof of the minimal gap conjecture