One dimensional kingdom

I’ve a doubt with a testcase [1 5][7 8][0 10] , i think that on destroying [0 10] ,then [1 5] and [7 8] gets automatically destroyed ,so ,only one bomb is required. am i right?

1 Like

if u put a bomb on x=6 then only [0,10] kingdom can be destroyed.
consider this statement

A kingdom of the form [L, R] can be destroyed completely by placing a bomb at a point x on the real line if L
≤ x ≤ R.


@raja44ever, will the answer for that is 2 or 1?

2 bombs. For example, one bomb at x=1 and another at x=7.

Give me some important test case it is not passing last test case of the first task

You cannot ask for hints during the contest!

1 Like

what about the case when kingdoms are overlapping ??
like [0,1][1,2] from my understanding only 1 bomb is required.
is it so ?

yes 1 bomb is required… you have to put a bomb in the range of any kingdom to destroy it whether there is overlapping or not…just put bomb efficiently so that minimum no of bombs is required