optimize to use O(k*(N-1)) times for find another M make N*M is only make up by one and zero in decimal