I want bottle neck and island question .
There are N bottles. ith bottle has A[i] radius. Once a bottle is enclosed inside another bottle, it ceases to be visible. Minimize the number of visible bottles.
You can put ith bottle into jth bottle if following condition is fulfilled:
ith bottle itself is not enclosed in another bottle.
jth bottle does not enclose any other bottle.
Radius of bottle i is smaller than bottle j (i.e. A[i] < A[j]).
1 <= N <= 100000.
1 <= A[i] <= 10^18.
First line contains a single integer N denoting the number of bottles.
Second line contains N space separated integers, ith integer denoting the radius of Ith bottle.
(1 <= i <= N).
Minimum number of visible bottles.
1 1 2 3 4 5 5 4
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]
finally there are 2 bottles which are visible. Hence, the answer is 2
thank you so much…
new ATM design question anyone?
does any one have odi score solution of codevita round 1zone 2?
All questions asked to me:
Bottle neck solution : here