Question 3

Find the first N words with the highest frequency in an array of strings. The result needs to be sorted by frequency.

For example:

An array of String:


{“computer”, “for”, “a”, “portal”, “to”, “learn”, “can”, “be”, “computer”, “science”, “zoom”, “yup”, “fire”, “in”, “be”, “data”,”computer”}

and the first 2 words with the highest frequency.

Outputs: {computer, be}

where computer has a frequency of 3 and be has a frequency of 2

New Report