We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b73e7df + 9c6494b commit dcc00d2Copy full SHA for dcc00d2
Week03/pyramid_niyazi_cetinkaya.py
@@ -0,0 +1,10 @@
1
+def calculate_pyramid_height(number_of_blocks):
2
+ height = 0 # Start with height 0
3
+
4
+ # Loop until blocks required for the next level exceed available blocks
5
+ while (height * (height + 1)) // 2 <= number_of_blocks:
6
+ height += 1
7
8
+ return height - 1 # Subtract 1 to get the maximum achievable height
9
10
0 commit comments