How do I find edge cases in DSA problems?
Are there some common edge cases that everybody knows about?
Is there some sort of method or procedure to find those edge cases?
Make things weird and try to break stuff.
This really doesn't have to be taught - It's more about bringing out your inner survival instinct. Humans have evolved over millions of years to be careful:
Tap into that worry and apply it to your code. Leverage your fear to conquer your fear. This is where I've seen mediocre engineers fail time and time again. They are afraid to face their fear of their code being bad. They only think about the happy flow. They only run the happy flow. That works in the beginning, but the second anybody tries something weird against their code, the happiness is smashed to pieces.
When you get a DSA problem or any problem really (it doesn't have to be FAANG or DSA), take the happy flow and mangle it as much as possible. In DSA, the interviewer will generally give you sample, neatly packaged test cases to illustrate the problem - Use those as a basis to turn everything on its head.
The edge cases will vary for different problems (these companies are trying to gauge your on-the-spot creativity), so you naturally can't (and shouldn't) study your way out of this. But to help you out, here's some common edge cases:
I want to make it clear that these are purely for inspiration. Your strategy for getting better at spotting edge cases shouldn't be just memorizing these (this doesn't scale). In the world of DSA and writing good code in general, there are far more ways things can break. Take a mental sledgehammer to any technical problem you work on, and your brain will naturally start building up the intuition and pattern recognition over time.
Check these out for even more inspiration (they cover how I graded Meta interview candidates in DSA, which includes edge case coverage):
For an extremely in-depth guide on how to become a better coder in general (not just DSA), check this out: "How to Learn/Practice Clean Code, particularly by oneself?"
I'd also embed this into your interview practice. Edbert talks about "Not Fixing Your Own Mistakes" in his talk about common mistakes among interviewees.
Alex's list of common edge cases is great: start there and add other edge cases as you find them!