IBM Interview Question

A question is about HashMap and sliding window logic.