add solve algorithm