finished row solver algorithm