Help for this page

Select Code to Download


  1. or download this
    use List::Util qw( min max );
    sub overlap {
    ...
      my $right = min( map $_->[ 1 ], @intervals );
      return max( 0, $right - $left );
    }
    
  2. or download this