Technically, this probably isn't an answer, but information that I hope will be valuable to you in your early career.
It isn't really a matter of either-or, here. But, you want to publish "good" papers in "appropriate" journals working with "helpful colleagues" when possible. What is "better" is better papers, actually.
Publishing low quality papers, in whatever journal, does you little good. The "fame" of a co-author might actually cloud your participation/contribution and might, when taken to the extreme, result in misconduct: i.e. "gift" authorship.
But collaboration is good. Not because it "puts points on the board" (which is IMO a foolish quest) but because it leads to better papers, deeper insight, and the faster advancement of a field. The collaboration can be, and usually is, among peers, though student/advisor collaborations are also common.
So, the advice is to write the best papers you can, collaborating as appropriate and as valuable, and submit to the best journals that you can. Think more about the fun of research and the advancement of the field and less about "winning" some imagined game.
Write a lot of good papers, singly or in collaboration, send them to good journals and your career has a good chance to succeed.