Modified the Next bigger number implementation