algorithm - optimizing -1