Lack of confidence is my biggest roadblock

I recently interviewed for one of the elite companies in tech, and surprisingly it went well . The problem is I always thought I was too stupid for these interviews which is why I never fuking studied for it. I self rejected myself from that company even before they had the opportunity to that. I wasted a golden opportunity and I feel like a loser. I don't know when will I ever get similar opportunity.FYI I did not clear the interview but I was still able to answer a bunch of questions correctly. Tech girlies where are you getting your confidence from ?