ADP interview question

Sliding windlow dsa medium question