All problems
Temporal Difference Frame Count
Problem
Count video frame pairs separated by a fixed temporal gap.
A pair (i, i + gap) is valid when i + gap is still a valid frame index, so return max(0, total_frames - gap).
Hint
Each valid first index i in [0, total_frames - gap) gives exactly one pair.
Test cases
case 1
in: [10,1]
expected: 9
case 2
in: [10,5]
expected: 5
case 3
in: [10,10]
expected: 0
case 4
in: [3,7]
expected: 0
Starter codePython
def temporal_diff_count(total_frames, gap):
# Your code here
pass4 test cases · run your code against them in the editor