Stacking Pentagons — Solution & Editorial
The closed form K²(K+1)/2 follows from summing k(3k−1)/2 with the square and triangular formulas.
Complexity: O(1)
The closed form K²(K+1)/2 follows from summing k(3k−1)/2 with the square and triangular formulas.
Complexity: O(1)