Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-308

Erasure Code Recover Check

Problem

An erasure code stores k data symbols plus n - k parity symbols and can recover any pattern of erased positions up to the number of parities. Return True when erasures <= n - k and False otherwise. Assume 0 <= k <= n and erasures >= 0.

Hint

With erasure positions known, each parity symbol can replace one missing data symbol.

Test cases

case 1
in: [4,6,2]
expected: true
case 2
in: [4,6,3]
expected: false
case 3
in: [10,10,0]
expected: true
case 4
in: [5,8,4]
expected: false
Starter codePython
def erasure_code_recover_check(k, n, erasures):
    # Your code here
    pass

4 test cases · run your code against them in the editor