All problems
Singleton Bound Max Dimension
Problem
The Singleton bound for a code of block length n and minimum distance d limits the message dimension to k <= n - d + 1. Return the largest feasible k, clamped at 0 when the parameters are impossible. Assume n >= 1 and d >= 1.
Hint
Every extra unit of minimum distance costs one dimension.
Test cases
case 1
in: [10,3]
expected: 8
case 2
in: [5,1]
expected: 5
case 3
in: [7,7]
expected: 1
case 4
in: [3,5]
expected: 0
Starter codePython
def singleton_max_dimension(n, d):
# Your code here
pass4 test cases · run your code against them in the editor