1. Learn
  2. /
  3. Courses
  4. /
  5. Optimizing Code in Java

Connected

Exercise

Implementing a text analysis application

You're developing a text analysis application that needs to count the frequency of words in a document. You need to implement a solution with optimal time complexity for word lookups.

Instructions

100 XP
  • Retrieve the currentCount for the word when it is already in the frequency map.
  • Increment it and update the frequency map the updated value.
  • If the word was not in the frequency map until now, add it.