Even though I knew the question but I forgot the approach! How do you get good at this? Especially problems you've never seen before!?
Role: Enterprise Systems Engineer
Position: Not sure (YOE: 5 years)
Location: London
A little more context here:
Let me rewind back 3 years to my first FAANG interview which was Microsoft. I do not have a software development background, I'm a Devops engineer and at that time I was a build engineer with minimal coding experience. So i just studied up on Java libraries and went to the SDE screening test like a boss. They asked two questions, one on string compression and other on buying and selling stock. I had absolutely NO IDEA how to solve them. Like literally I didn't know such questions existed. I wrote a convoluted code for the first one and didn't even attempt the 2nd. Obviously failed. Duh.
Forward to 3 years and now I'm a Devops engineer with still minimal coding experience. But this time when the Facebook call came, I did not make the same mistake. I read up on ds, algorithms and solved around 80 LC problems (50 easy , 30 medium, a couple of hards), even read through CTCI and solved a couple of chapters worth of problems.
I was asked a very very simple array question which was already present in Glassdoor for my role, which I had practiced too!! It is so simple I am embarrassed I couldn't do it. The question was to split an array into two sub-arrays such that both parts have equal sums. But I forgot the approach, I cobbled up a two pointer method that probably worked and there was no time for the other question. I failed spectacularly. There is probably a perfect two pointer solution out there somwhere. But mine wasn't it.
So I don't know what to do now. How do I think differently? Think fast? Think accurate? I'm not sure if I am cut out for this. Practice seemed to be the key but I did practice and it still didn't work! I have another interview in a month and I don't want to mess that up too!
Sorry for the long post..! If you're still here, please advice!!