Company: Robinhood

Difficulty: easy

Problem Statement

Word Frequency Report Problem Description You are given a block of text. Split it into words , count how often each word occurs, and print a frequency report. A character is a word character if and only if it is an English letter ( a – z , A – Z ) or a digit ( 0 – 9 ). Every other character — whitespace, newlines, and every punctuation mark such as . , ; : ! ? ' " - _ ( ) [ ] { } / \ | @ # $ % ^ & * + = < > ~ ` — is a separator and is never part of a word. A word is a maximal run of consecutive word characters. Punctuation inside a token therefore breaks it apart: state-of-the-art yields the four words state , of , the , art , and don't yields the two words don and t . Matching is case-insensitive : The , the and THE are all the same word, and it is reported in lowercase. Ordering Report the distinct words sorted by descending frequency . Words with equal frequency are ordered lexicographically ascending , comparing the lowercase words as plain A

More Robinhood OA questionsInterview experiences