Q: How should I prepare for coding interviews of a certain standard sort ("algorithms and data structures interviews," "whiteboard interviews," "Leetcode interviews")?
A: Do your best to mimic the actual environment of your interview:
Choose a few problems that (i) are a bit harder than will typically be asked and (ii) exercise a few essential skills (graph traversal, binary search, whatever). Do them repeatedly, as drills.
LeetCode is better as a question repository and discussion forum than as a platform for testing your answers. The platform will confront you with overflow / underflow cases and other edge cases that your interviewers will overlook, guide you through, or happily leave underspecified. It's good to know about (e.g.) overflow, but it's inefficient to spend so much practice time on it.
Definitely try to learn all the essentials, but not at the expense of becoming more fluent in areas you know pretty well. People sometimes spend 10 to 25 hours struggling with the tricker parts of dynamic programming or XOR hacks when they would be better off using that time to absolutely nail down basic graph search algorithms.
Practice the skill of plugging away at a problem when you're stuck, but treat it as one skill among many. So: don't spend too much time struggling when you're stuck. It's more important to learn all the basic question types.
Cracking the Coding Interview is an excellent question repository (and a bit underrated as an instruction / reference book). The Algorithm Design Manual is a pleasant and very different sort of reference, with plenty of "aha" moments. But beware of the trap of substituting passive reading for active preparation.
Email me if you have other questions.
More posts about programming