All problems
Histogram Intersection
Problem
Compute the histogram intersection of two equal-length histograms.
Return the sum of min(h1[i], h2[i]) over all bins.
Test cases
case 1
in: [[1,2,3],[2,1,3]]
expected: 5
case 2
in: [[1,0],[0,1]]
expected: 0
case 3
in: [[2,4,6],[2,4,6]]
expected: 12
Starter codePython
def histogram_intersection(h1, h2):
# Your code here
pass3 test cases · run your code against them in the editor