All problems
LSM Level Capacity
Problem
Compute the file capacities of leveled LSM-tree levels.
base is the capacity of level 0 and each subsequent level multiplies the previous capacity by ratio.
Return the capacities for num_levels levels, starting at base.
Hint
Each level's capacity is the previous level's capacity times the growth ratio.
Test cases
case 1
in: [2,2,4]
expected: [2,4,8,16]
case 2
in: [1,10,3]
expected: [1,10,100]
case 3
in: [5,1,3]
expected: [5,5,5]
case 4
in: [0,2,3]
expected: [0,0,0]
Starter codePython
def lsm_level_capacities(base, ratio, num_levels):
# Your code here
pass4 test cases · run your code against them in the editor