solutions consider row shifting aswell