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:

Inputs:

{“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

[advanced_iframe securitykey=”undefined” src=”https://code.kodnest.com/” width=”100%” height=”600″]

KodNest Training New Batch is starting on 19th October 2020. Attend one week free demo classes.Register Now

New Report

Close