Algorithm/DS Problem#3: Minimum non-overlapping bridges

svalak
May 27, 2021

You are given n coordinates[north, south] of N bridges
Count of maximum number of non-overlapping bridges.

Ex: [[6,2],[4,3],[2,6],[1,5]]    6 4 2 1 North
2 3 6 5 South
B1 B2 B3 B4
Output: 2
For non-overlapping bridges, the following is TRUE:
north1 < north2 and South1 < South2
1 < 2 and 2 < 6
Idea here is to do the below:
(a) Sort all bridges based on north bank
(b) Find the LIS(Longest Increasing Subsequence) for each bridge based on south bank

--

--

svalak

Passionate about problem solving; #VoraciousReader #MBTIEnthusiast #LovePsychology