educative.io

Educative

Input to the alternative approach

Hi there,

From my understanding, the alternative approach using HashMap does not require the input to be sorted. Can you please confirm this? Thanks!

Yes, you are right. You don’t need sorted data for HashMaps.