Two questions 45 mins (roughly 35- 40 mins to discuss & code)
Given a red tape and a set of blue tapes. Tape is represented by interval. We paste red tape on the line first and paste blue tapes onto the line later. If blue tapes have overlap with red tape, the overlapping part will be covered by blue tapes. You need to return a boolean to indicate whether red tape is visible after pasting all blue tapes. You could assume that the blue tapes array are sorted by the start point.
Input: Red tape: [1, 6] Blue tapes: [1, 3] [3, 5] Output: True
Input: Red tape:[3, 5] Blue tapes: [1, 4], [6, 7] Output: True
Input: Red tape:[3, 5] Blue tapes: [1, 4], [4, 7] Output: False
Given an input of connected islands in terms of a list of pairs: (a, b), (b, c), (e, f)
(a, b) means a and b are connected.
Find out all groups of connected islands: (a, b, c), (e, f)
(Application of Disjoint union set I suppose)
May Lady Luck be with you!