On the minimal overlap problem of Erdös