DZone

[Question/Problem Statement is the Property of HackerRank]

Algorithms/Data Structures — [Problem Solving] 
An Institutional Broker wants to Review their Book of Customers to see which are Most Active. Given a List of Trades By “Customer Name, Determine which Customers Account for At Least 5% of the Total Number of Trades. Order the List Alphabetically Ascending By Name.”
Example

n = 23

“customers = {“Bigcorp”, “Bigcorp”, “Acme”, “Bigcorp”, “Zork”, “Zork”, “Abe”, “Bigcorp”, “Acme”, “Bigcorp”, “Bigcorp”, “Zork”, “Bigcorp”, “Zork”, “Zork”, “Bigcorp”, “Acme”, “Bigcorp”, “Acme”, “Bigcorp”, “Acme”, “Littlecorp”, “Nadircorp”}.”

“Bigcorp had 10 Trades out of 23, which is 43.48% of the Total Trades.”

“Both Acme and Zork had 5 trades, which is 21.74% of the Total Trades.”

“The Littlecorp, Nadircorp, and Abe had 1 Trade Each, which is 4.35%…”

“So the Answer is [“Acme”,”Bigcorp”,”Zork”] (In Alphabetical Order) Because only These Three Companies Placed at least 5% of the Trades.

Function Description
Complete the Function mostActive in the Editor Below.

mostActive
has the following parameter:
String customers[n]: An Array Customer Names
(Actual Question Says String Array, But Signature is List of Strings)

Source: DZone