singlenumber in java and python version, using map data structure