High temperature superconductivity has been found in many kinds of compounds built from planes of Cu and O, separated by spacer layers. Understanding why critical temperatures are so high has been the subject of numerous investigations and extensive controversy. To realize high temperature superconductivity, parent compounds are either hole-doped, such as {La$_{2}$CuO$_4$} (LCO) with Sr (LSCO), or electron doped, such as {Nd$_{2}$CuO$_4$} (NCO) with Ce (NCCO). In the electron doped cuprates, the antiferromagnetic phase is much more robust than the superconducting phase. However, it was recently found that the reduction of residual out-of-plane apical oxygens dramatically affects the phase diagram, driving those compounds to a superconducting phase. Here we use a recently developed first principles method to explore how displacement of the apical oxygen (A-O) in LCO affects the optical gap, spin and charge susceptibilities, and superconducting order parameter. By combining quasiparticle self-consistent GW (QSemph{GW}) and dynamical mean field theory (DMFT), that LCO is a Mott insulator; but small displacements of the apical oxygens drive the compound to a metallic state through a localization/delocalization transition, with a concomitant maximum $d$-wave order parameter at the transition. We address the question whether NCO can be seen as the limit of LCO with large apical displacements, and elucidate the deep physical reasons why the behaviour of NCO is so different than the hole doped materials. We shed new light on the recent correlation observed between T$_c$ and the charge transfer gap, while also providing a guide towards the design of optimized high-Tc superconductors. Further our results suggest that strong correlation, enough to induce Mott gap, may not be a prerequisite for high-Tc superconductivity.