Skip to content

Instantly share code, notes, and snippets.

View avidas's full-sized avatar

Avi Das avidas

View GitHub Profile
@avidas
avidas / file1.md
Last active August 29, 2015 13:55
open issues
@avidas
avidas / file1.txt
Created January 29, 2014 21:31
xyz
String file
@avidas
avidas / merge_interval
Last active December 22, 2015 01:28
Given two lists with date ranges, return merged list with ranges from higher priority list preferred over ranges from lower priority list in case of intersection. Partial intervals are allowed.
def merge_interval(low_priority_lst,high_priority_lst):
'''
Given two lists with date ranges, return merged list with high_priority_lst ranges preferred over
preferred over low_priority_lst ranges in case of intersection. Partial intervals are allowed.
'''
if low_priority_lst == [] or low_priority_lst == None: return high_priority_lst
if high_priority_lst == [] or high_priority_lst == None: return low_priority_lst
# k way merge interval, also may need to mark which array it belongs to
# case : |-------|