20_firewall_rules.rb
# Assumes without checking that input intervals are sorted by start time.
Assumes without checking that input intervals are sorted by start time.
Assumes without checking that input intervals are sorted by start time .
def min_unblock(intervals)
  unblocked = 0
  intervals.each { |min, max|
    return unblocked if min > unblocked
    unblocked = [unblocked, max + 1].max
  }
end
def min_unblock ( intervals ) unblocked = 0 intervals . each { | min , max | return unblocked if min > unblocked unblocked = [ unblocked , max + 1 ] . max } end
Assumes without checking that input intervals are sorted by start time.
Assumes without checking that input intervals are sorted by start time .
intervals
<not_specific>