Skip to content
DeepForgeby svx
All problems
EasyInformation Theoryinfo-307

Fountain Code Overhead

Problem

A fountain decoder needs slightly more than k encoded symbols to reconstruct the original k symbols. Return the fractional overhead (received - k) / k, which is negative when fewer than k symbols arrived. Assume k >= 1.

Hint

Overhead is measured relative to the number of source symbols.

Test cases

case 1
in: [100,105]
expected: 0.05
case 2
in: [50,50]
expected: 0
case 3
in: [20,24]
expected: 0.2
case 4
in: [10,8]
expected: -0.2
Starter codePython
def fountain_code_overhead(k, received):
    # Your code here
    pass

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