This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sort jobs by finish times so that f1<=f2<=..<=fn | |
# π΄ β β , πππ π‘ β 0 | |
# for π β 1 to π | |
# if π π β₯ πππ π‘ then π΄ β π΄ βͺ {π}, πππ π‘ β ππ | |
# return οΏ½ | |
require('set') | |
def minimum_room_no(times) | |
times = times.sort {|a,b| a[1] <=> b[1]} |