Once you recognize the different variations, you solve a bunch of those problems to become more efficient at 'em.
Really, it's no different than solving certain calculus problems. If you've solved enough integrals that require certain substitutions and identities, you'll notice them right away - but of course, if you've never seen 'em before, the problems can become next to impossible - given a very limited time fame to solve them.
Sure - some candidates will be highly intelligent, notice intricate patterns right away, and solve them on the spot (in the same way they'd perform on IQ tests), but for the majority it's just discipline and preparation.
There's a reason people are following these ridiculous study guides, which involve hundreds to thousands of Leetcode/hackerrank/etc. questions. If you actually study the problems, and do them over and over again, you'll get there.
And by "just" doing that, you can indeed outclass the so-called elite candidates.
I've gone and reread Skiena, etc but the end result ends up just my eyes glazing over proof notation and crying.
Take it from someone who also had a shit background/education in math/CS and had to teach myself a lot of these things from scratch - it's doable, you just need time, and I guess the mindset that you can learn these things. See my comment history for some book recommendations. If you really feel like you need to learn things from scratch to give yourself the confidence of having a solid foundation, look at some of the intro computer science courses on Coursera. When I realized most of my uni's cs courses were... not great, I just ended up going through courses like Stanford's Introduction to Algorithms on Coursera and teaching myself.
I can also tell you as someone who was in Seattle for a while and had a bunch of friends at Amazon, I don't think anyone is going to think less of you, if anything, being able to survive at a place like Amazon seemed to be recognized as its own accomplishment...
edit: I'll also add (from personal experience), if it still feels like these things are difficult even once you feel like you have all the right resources, look into seeing medical professionals to make sure you're not being held back by anything, like sleep apnea, any cognitive disability (not sure if that's the right term...) etc
Then, this comment that I'm currently replying to, pins most of the responsibility on not "having the genes for it."
Your HN username also leads me to think you have a "fixed mindset" around your capabilities.
Regardless of to what extent (1) and (2) impact general career success, I suspect your mindset is a self-limiting one. For example, even if 80% of a person's success was determined by their genes and pedigree, and only 20% by their personal effort or resourcefulness, I suspect the mindset you have is to focus on lamenting the fact that you don't have the 80% and neglect the 20% you do have control over, leaving it on the ground and thereby reducing your own chances of success. It'd be a little bit like someone who wasn't born particularly tall, saying "Well, what's the point of drilling dribbling, passing, defending or shooting? There's no way I'll ever be the world's best player with genes like mine?" resulting in a self-defeating and self-fulfilling prophecy of failure.[1]
I don't want to come off as a preachy person on the internet to someone who I don't know, but if I could make a suggestion I would be curious for you to introspect as to why you may have this worldview. Folks I know in real life who have a mindset similar to those expressed in your comments often seem to feel insecure, unconfident or otherwise engage in self-shaming and constant comparisons with others.
[Edit] In the spirit of sharing, I will confess that that your mindset also reminded me of mine when I was in college. I had gotten rejected from a large number of universities I wanted to attend, and had only gotten into my state university. My peers and friends from high school largely went to prestigious brand-names.
The insecurity gnawed at me and made me engage in many foolish behaviors during college, and also caused me to constantly compare myself with others. I was ultimately very unhappy.
Through a series of experiences (i.e. therapy, honest introspection and self-reflection, conversations with trusted friends, being challenged on my mindset by others), I slowly came to understand how my mindset contributed to the same failures I was complaining about.
It's been over a decade since then and I have long since shed the mindset that held me back then, and am much happier for it.
-----
[1] Even this example is probably inaccurate because it draws from a domain where genetics play a larger role than I think they do in professional success. I suspect many attributes of a successful professional come from behaviors and tactics that are learned through social mimicry and learning from others rather than some genetic predisposition towards e.g., being thoughtful, being articulate and concise, running effective meetings etc.
I was the same way in college, but I also didn’t go to Berkeley, rather a school 80 or so spots below. I wish I could fix myself, but the therapy I’ve done hasn’t helped and my general lack of accomplishments in life contributes.
And even if you had gotten into Stanford, I wonder if you would feel insecure around the Stanford whizzes who seemed like geniuses.
And even if you were one of those top academically performing students, I wonder if you would still continue to compare yourself to the most elite in that circle (i.e., "Joe got a research internship at Google Brain as a Sophomore! I just have this lousy Facebook internship that it seems like half my peer group got.")[1]
My point is this: if you choose to, you will almost always find a way to be miserable. This isn't a personal attack on _you_ specifically. I think all humans engage in this sort of constant comparisons, at least to some degree. I do this too.
But I'm pointing this out because there's also a component to this that is our _choice_. We choose who we compare ourselves against, and we choose how that comparison affects us (e.g., as a source of inspiration, as a source of excitement, as a source of self-deprecation).
I notice that in your comments, it seems like you have willing given up your choice and agency over to some set of other immutable forces, like your genes, your school's ranking or some other force.
I hope you reclaim your agency and power. It just seems a shame to a whole life in which you willingly give away your agency to be happy.
Finally, as for "fixing yourself", I would just observe that a useful framework for mental wellness to use is that of physical health: being healthy is a choice we can make, and we need to keep on making on a daily basis. At no point can you say, "Well, I'm fit and healthy now so I guess I can go back to eating chips and chugging beer." Fitness isn't a state that is obtained and can never be lost. It's a process of constant daily choices to improve and maintain. It's also affected by genetic and external factors we have little control over.
In that way, I think it's similar to mental health. You may not be able to "fix" yourself by seeing a therapist a few times. But you can continuously improve your mental health by noticing each time you compare yourself with a stranger online, engage in self-shaming, talk "down" to yourself, or blame your genes. Those choices can compound over time, and given a long enough time period, will start to show marked improvements in the same way that doing some pushups, pullups, squats etc. consistently every day for months or years will improve your physical health.
I wish you the best of luck.
--------
[1] That example is something I have actually seen in peers/friends who, by external accounts, seem very successful. But they themselves are miserable because they're always comparing themselves with someone else who seems even more successful. "Comparison is the thief of joy." - Teddy Roosevelt.