Solve windowed duplicates and target expression | Meta Interview Question