Solved valid triangle Ruby problem