New York City Mayor Zohran Mamdani tried to thread a needle on the third anniversary of the Oct. 7 attacks by condemning Hamas’ “horrific war crimes” and denouncing Israel’s “genocide” in Gaza.