Nearest Opposite Parity

Nearest Opposite Parity

Can anyone plz explain how to do this? I tried going through the editorial but still couldn’t do it…