How many bombs are required to destroy [7,8] and [7,8] i.e two same kingdoms


As you can see in the sample input, putting a bomb on x=2 destroys two kingdoms.
In the case you mentioned, only one bomb is required.


by x=2 you meant x=7 or x=8 right?


I was talking about the sample input, but now I see that the my last sentence was unclear. I edited it.


@mogers, i’m getting wrong answer from last two days , any possible test case,i’m unable to trace it.