cpp implementation of Single Integer II