Language choice

Use Python. It is dramatically more interview-friendly for two reasons.

First, Java requires far more boilerplate. By the time you have written the scaffolding for a HashMap with a list value, or set up a PriorityQueue with a comparator, your Python counterpart is already thinking about optimizations.

Second, and this one surprised me: almost every interviewer I encountered had Python code skeletons and test cases ready to go. Switching to Java means you are not just writing boilerplate on top of solving the problem, you are also manually rewriting the function stubs and test cases the interviewer prepared for you in Python.

If you genuinely need to use Java, at least make sure you know these:

  • Records: a huge time saver for structured data
  • Set.of() and List.of() for quick initialization (note that these are immutable)
  • Map.getOrDefault() instead of the if-containsKey-then-put pattern
  • .equals() for string comparison, not ==. This one is genuinely hard to debug during a timed interview

For each question

Read the problem carefully, and read it out loud or at least murmur through it so the interviewer can follow where you are. Silence is uncomfortable for them and they cannot help you if they do not know what you are thinking.

A few things that trip people up repeatedly:

Watch out for regex edge cases

Know your basic regex expressions. Matching on a period in Java requires "\\.", which is the kind of thing that will stump you cold during a timed interview if you have not seen it before.

Know your standard data structures

Lists (linked vs array-backed), maps and sets (tree vs hash), and their performance tradeoffs. Knowing when to reach for a TreeMap versus a HashMap is the kind of thing that separates practiced candidates from unprepared ones.

Do not hesitate to combine data structures

A map and a linked list together is exactly what the LRU cache question is testing. There is even a LinkedHashMap in Java built for exactly this case. Do not feel like you need to solve everything with a single structure.

Call out concurrency

At senior level and above, look for opportunities to call out where concurrency or multithreading would be a problem in your solution. You probably will not be expected to implement it, but you will be expected to notice it. Mentioning it signals that you think about production systems, not just correctness.

Always have your complexity answer ready

You will always be asked about time and space complexity. Always. Have the answer ready before you finish writing your solution, not after.

Key data structures

Priority queues come up in almost every loop I was in. Know how to build both min and max heaps and when to use each. In Python, heapq is a min-heap by default. Negate your values to simulate a max-heap.

Maps are the workhorse of most interview problems. If you find yourself writing nested loops, there is usually a map that collapses it to linear time. Train yourself to ask "can I pre-compute this into a map?" before settling on a brute-force approach.

Sets are for membership checks and deduplication. Straightforward but easy to forget when you are nervous.

Sliding window is the technique for contiguous subarray or substring problems. Two pointers: expand right, shrink left when the window violates a condition, update your answer at each step.

The preprocessing pattern

A huge number of interview problems come down to: take unordered input, transform it into an efficient structure, then query that structure. The first few lines of your solution are often just organizing the data. Get comfortable with this pattern and you will recognize it faster under pressure.