Help Needed in Infosys coding question

given an array of ring sizes and bucket size of 3
we have to fill the rings in the bucket such that ring1<ring2<ring3
find the minimum no of buckets needed?
arr[]=1,1,2,2,3,3,3,4,4. size of bucket=3
ans=3
bucket1=2,3,4
bucket2=1,2,3
bucket3=1,3,4

can you tell me the effiecient solution

highest frequency is 3.so answer will be 3.

what if array is 1,1,2,2,3,3,4,4,5 your ans=2 but the ans=3

how answer can be three ?

b1=1,2,3
b2=1,2,4
b3=3,4

b1 =1,2,3
b2=1,2,4
b3=3,4

Use binary search because answer in monotonic.