Logics Flashcards

1
Q

Ugly Number

A

Take minimum from 2* 3* 5*. Order is important. Maintain three indexes or Set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly