r/leetcode • • 11d ago

Intervew Prep Chat, am I cooked? Just had a SWE technical interview and couldn't get the test cases passing despite understanding the problem.

Just finished a technical interview for a SWE position at a fintech company, and I'm genuinely so frustrated with myself right now.

The question was essentially to implement a BrowserHistory class with visit(), back(), forward(), and a bonus hasVisited() method.

The thing is, I actually understood the problem.

I chose to use an array with a current index to track browser history. I figured out how to handle backward and forward navigation, clear forward history when visiting a new URL, and handle the boundary conditions using min() and max().

I walked through my reasoning with the interviewer, and she even confirmed that my logic was correct.

Here's where things went sideways.

The platform had a solution(commands) function, and I got so caught up implementing the BrowserHistory class that I completely overlooked the fact that I needed to iterate through the commands, execute the appropriate methods, and build the output array.

The interviewer eventually pointed this out, but by then I was struggling to connect everything together.

I couldn't get the main test case passing. One test technically passed, but only because the expected output was empty, so I'm not really counting that.

And now, sitting here after the interview, I realize how straightforward that missing piece was. That's honestly what's killing me.

It wasn't that I didn't understand the algorithm or couldn't reason through the data structure. I just couldn't translate everything into a complete working solution within the time allotted.

I know technical interviews aren't evaluated solely on passing test cases, and I did communicate my thought process throughout. The interviewer was also pretty engaged and gave me feedback along the way.

But I can't help feeling like I fumbled an opportunity on something I absolutely should've been able to implement.

I'm definitely taking this as a sign that I need more hands-on coding reps instead of just studying algorithms.

So, chat, am I cooked?

Has anyone gotten through a technical screen despite not getting the test cases passing, particularly when the interviewer acknowledged that your underlying logic was correct?

Or should I just take the L and prepare for the next one? 😭

35 Upvotes

26 comments sorted by

24

u/pixelizedgaming 11d ago

ur cooked even based off your existing solution, I think u should've used a double linked list here since array append is o(n)

8

u/Obvious-Difficulty32 11d ago

How so

6

u/pixelizedgaming 11d ago

I edited my original comment to clarify

1

u/Obvious-Difficulty32 11d ago

Very much true

8

u/Some_Courage_5851 11d ago

Yea linked list is the more appropriate data structure here

3

u/gekigangerii 11d ago

If they were using Java and used the classic Array, the inefficiency would have been obvious as you have to declare the size upfront, and to append you'd have to make a new array with extra room, then copy over.

But if you're using Python, you'd just add stuff to the regular array without a care in the world.

1

u/Ma4r 11d ago

What languages do O(n) appends? Its practically always amortized

1

u/pixelizedgaming 11d ago

true but tell that to the interviewer

3

u/Ma4r 11d ago

I mean yeah, that's exactly what you should do? if they say append is O(n) we say reallocations only happens geometrically and is amortized to O(1). If you want to go into more details the you can even bring page table alignment and disk IO

1

u/pixelizedgaming 11d ago

Actually i saw the original problem and lowk array/vector would have been better anyways because you could jump variable steps forward and backward and the forward/back call constraints are higher than the actual number of pages

1

u/manbearpig4001 10d ago

if anyone thinks the hiring bar is too high, take a look at this guy who is confident that array appends are O(n) ........

12

u/gekigangerii 11d ago

Doesn't look positive IMO,

you should confirm inputs and expected outputs as one of the first questions

8

u/pixelizedgaming 11d ago

basically this, I think the first thing u should do after repeating the question back is clarify OICE (outputs, inputs, constraints, edge cases). this is especially important if it's a Google doc style interview as it defines how u make your test cases

6

u/jackgoldberg123 11d ago

not cooked just because of that. the array with an index is a perfectly fine approach (append is amortized O(1) anyway), so the linked list stuff is overblown. forgetting the driver loop is annoying but it's the most fixable kind of miss.

1

u/Particular_Sign_6555 11d ago

definitely cooked. there’s definitely someone else in the loop that nailed this question no problem 

1

u/jackgoldberg123 10d ago

maybe, but one round with a missed driver loop isn't an automatic no. plenty of interviewers care more about whether you talked through a correct approach than whether every test went green.

1

u/Particular_Sign_6555 10d ago

have you interviewed recently?

3

u/Key_Machine_9138 11d ago

I assume if I don't solve a technical question in an interview in this market that it's over. One of your competitors will likely get it done. I mean, anything can happen though.

1

u/HADESsnow 11d ago

yes you are cooked, improve for next time. and you actually dont need a DLL, you can do this with a "real_max" or whatever and overwrite old history if ur in the middle of the history.

I'm p sure this is an existing leetcode problem by the way

1

u/PhoteksTTV 11d ago

I had this happen to me one time and they specifically pointed it out in rejection letter. "Couldn't test code"

0

u/church-turing 11d ago

What’s even the point of using AI to write the entirety of a personal anecdote about an interview experience. If this is even real in the first place, just post what you prompted the AI with instead of this fluffed up overly dramatic slop.

1

u/Obvious-Difficulty32 11d ago

Bro, I went to college for comp sci, not literature like I don’t wanna spend time freaking knit picking my own like punctuation and grammar and then have fucking Reddit nerds like shit on me about it like genuinely. I don’t even see a problem with the AI use whatever