Logics Flashcards
1
Q
Ugly Number
A
Take minimum from 2* 3* 5*. Order is important. Maintain three indexes or Set
2
Q
Merge Intervals
A
Take List of int[]
if(last[1] < next[0]) – just add it
else merge it – update last end to max
3
Q
Insert Intervals
A
add all intervals less than new one - compare with start
add new interval and merge if need
do the merge interval logic from here