There are N bottles. ith bottle has A[i] radius. Once a bottle is enclosed inside another bottle, it ceases to be visible.
Answers
Answered by
1
Answer:
Hey friend here's your answer:
Example 1
Input
8
1 1 2 3 4 5 5 4
Output
2
Explanation
1st bottle can be kept in 3 rd one 1-->2 , which makes following bottles visible [1,2,3,4,5,5,4]
similarly after following operations, the following will be the corresponding visible bottles
Operation ? Visible Bottles
2 ? 3 [1,3,4,5,5,4]
3 ? 4 [1,4,5,5,4]
4 ? 5 [1,5,5,4]
1 ? 4 [5,5,4]
4 ? 5 [5,5]
Similar questions