Array manipulation1

can u please suggest a mehtod other then brute force to solve this problem

Hi @pradyumn2006, you may observe something here. And the thing is that largest value will be at that index/place which appears in maximum no. of intervals . For ex:
in testcase

1 5 3
4 8 7
6 9 1

Lets represent this information in some nice format, which is :

              [0,0,0,0,0,0,0,0,0,0]
[1,5] ->   [-----------               ] - 3
[4,8] ->   [         -----------      ] - 7
[6,9] ->   [              ------------] - 1

Now, you see the max value will be at the place at which maximum no. of intervals intersect.
But there is a problem for the value. So you have to tackle that on your own.

@pradyumn2006 I have gave you a major hint. Now pls try out the question. Also always try to tackle these questions on your own. Try really hard and only after that ask for help.

Hope this helps :slight_smile:

I am marking this doubt as resolved as you have not replied to this thread for five days.
In case, you still have some doubts regarding the same problem, you can reopen this doubt.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.