Abinoam Jr. wrote in post #1136120:
> Dear Arup,
>
> Sorry if I misunderstood the requirements.
> But, I think there is two "FIRST THREE" in play over here.
>
> For [ 3, 4, 5, 3, 3, 4, 4, 4, 5 ] what do you expect to get in return?
>
> Because the line
>
> num_to_del = a.find { |e| a.count(e) >= 3 }
>
> Finds the only the first number in array that has three duplicates.
> So it will find 3 and not 4. ( I misunderstood this as being a "First
> Three Duplicate Number" )

Yes with your example target element would be 3.

> After that, do you want do delete the first 3 occurrences of the number
> 3 ?

Yes, exactly. output should be [ 4, 5, 4, 4, 4, 5 ]

> So, if there's only 3 number 3s. It will rest none of them?
> But, with the number five that has only 2 elements. it will rest the
> two of them? (more than the 3 number)

If there is 5 3's, first 3 occurrence will be deleted, rest will be as
it is.

> And the 4 number, that has more than three duplicates, it rest all the

Nothing to be done with, as we got first 3, which has met the condition
`>=3`

> The sorting order of the elements are important?

elements order should be preserved there, no need to sort.

> If you have one more triplet like in [3, 4, 5, 3, 3, 3, 3, 3] with 6
> number 3s?

Expected output is [4, 5, 3, 3, 3].

> Best regards,
> Abinoam Jr.

--
Posted via http://www.ruby-forum.com/.