We introduce additional coalescence factors for the production of strange baryons in a multiphase transport (AMPT) model in order to describe the enhanced production of multistrange hadrons observed in Pb + Pb collisions at √ s NN = 2.76 TeV at the Large Hadron Collider (LHC) and Au + Au collisions at √ s NN = 200 GeV at Relativistic Heavy-Ion Collider (RHIC). This extended AMPT model is found to also give a reasonable description of the multiplicity dependence of the strangeness enhancement observed in high multiplicity events in pp collisions at √ s = 7 TeV and p-Pb collisions at √ s NN = 5.02 TeV. We find that the coalescence factors depend on the system size but not much on whether the system is produced from A + A or p + A collisions.The extended AMPT model thus provides a convenient way to model the mechanism underlying the observed strangeness enhancement in collisions of both small and large systems at RHIC and LHC energies.