some algorithm problem