IMO the key thing is that interviews have a heavy component of randomness.
The question your interviewer selects (both topic and difficulty), how the interview performs as far as presenting the question/giving hints, how the interviewer is feeling, any biases the interviewer might have, and so on.
You can of course 'increase your surface area for luck' by studying the questions/topics a company tends to ask, being an interviewee who comes off as well qualified.
But, if you get an interviewer who is in a bad mood, if your interview isn't competent or paying attention, etc. then you're just screwed.
---
I say this because the OP was honest and failed; you were honest and were hired. There's no 'secret' to getting in. It is a combination of:
1. Being a competent engineer (or student)
2. Putting in the time to study, leetcode, practice, etc.
The question your interviewer selects (both topic and difficulty), how the interview performs as far as presenting the question/giving hints, how the interviewer is feeling, any biases the interviewer might have, and so on.
You can of course 'increase your surface area for luck' by studying the questions/topics a company tends to ask, being an interviewee who comes off as well qualified.
But, if you get an interviewer who is in a bad mood, if your interview isn't competent or paying attention, etc. then you're just screwed.
---
I say this because the OP was honest and failed; you were honest and were hired. There's no 'secret' to getting in. It is a combination of:
1. Being a competent engineer (or student)
2. Putting in the time to study, leetcode, practice, etc.
3. Luck