JAVA · SERIES · BEGINNER

Java Coding Interview Prep: 50 Problems in Order.

Rusty before a Java coding round? Solve 50 classic interview problems in an order that builds on itself: arrays, strings, collections, HashMap, Comparator, stacks and queues, then streams and the tricky stream puzzles interviewers love. Every problem has plain-English steps, clean code and the follow-up questions you will hear.

PARTS
9
READING TIME
~41 min
LEVEL
beginner

After this series you can

  • Know which problem to practise first, and why each one prepares you for the next.
  • Solve the classic array and string problems with two pointers, counting arrays and HashMaps.
  • Pick the right collection (ArrayList, HashSet, LinkedHashSet, HashMap, ArrayDeque) and say why out loud.
  • Sort objects with Comparator chains and sort a Map by its values.
  • Answer Java 8 stream questions with filter, map, sorted, groupingBy, partitioningBy, toMap and flatMap, including the traps interviewers ask about.
WHO IT'S FOR

Java developers getting ready for a coding round, especially if it has been a while since you last solved puzzles. You should know basic Java syntax; nothing else is assumed.

The path — 9 parts, in order

Every part also stands on its own.
  1. PART 01How to prepare for a Java coding interview: 50 problems in the right orderYou open LeetCode, pick a random problem, get stuck in ten minutes and close the tab. The problem isn't you, it's the order. Here is a study plan of 50 classic Java interview problems, grouped into eight short phases, where each one quietly prepares you for the next.6 min read
  2. PART 02Java array interview programs: 7 problems every beginner should solveMax and min, reverse, second largest, remove duplicates, move zeros, rotate by K and find the missing number. Seven small array problems that teach the moves behind half of all coding interviews: loops, two pointers, swaps and a little arithmetic.3 min read
  3. PART 03Java string interview programs: anagram, first non-repeating character and frequencyFour string problems that come up in almost every Java coding round: check two anagrams, find the first non-repeating character, find the first repeating character, and count each character. They all come down to one skill: counting things.4 min read
  4. PART 04Java ArrayList and Set interview programs: duplicates, common elements, union and sortingRemove duplicates from a list, find the common elements of two lists, take their union, and sort a list both ways. Four short problems that are really one question in disguise: do you know which collection to pick, and why?4 min read
  5. PART 05Java HashMap interview programs: word count, most frequent element and group anagramsThree HashMap problems, from easy to a true interview favourite: count the words in a sentence, find the element that appears most often, and group anagrams together. Along the way you'll learn getOrDefault, merge, entrySet and computeIfAbsent for good.4 min read
  6. PART 06Java Comparator examples: sort objects by salary, then age, and sort a Map by valueSorting numbers is easy. Interviewers want to see you sort objects: employees by salary, highest first, with ties broken by age. Then the classic follow-up, sort a HashMap by its values. Here is Comparator from the first line to the last, in plain English.4 min read
  7. PART 07Java stack and queue interview programs: valid parentheses, reverse a queue, binary numbersA stack hands back the last thing you put in. A queue hands back the first. Three classic problems show when each one is the right tool, and why modern Java code uses ArrayDeque for both instead of the old Stack class.4 min read
  8. PART 08Java 8 stream interview questions on an Employee list, with answers"Here's a list of employees. Using streams, give me..." Seven questions that open countless Java interviews: filter by salary, get the names, sort, top 3, average, group by department and the highest salary in each. Each one explained step by step.4 min read
  9. PART 09Advanced Java stream interview questions: 18 tricky puzzles with CollectorsSecond highest salary. Duplicates in a list. First non-repeating character. Average salary per department. The toMap duplicate-key trap. These are the stream questions that separate "I've used streams" from "I know streams". Each one built from pieces you already know.8 min read

Where to go next

JAVA · SERIESbeginner

Java for AI Engineers

The Java skills you need to work with LLMs and build AI agents. Start with how models behave and a plain HttpClient call, then grow into Spring AI, LangChain4j, tools, MCP, RAG and agents. No Python, no maths.

5 PARTS · ABOUT 42 MIN

More Java series

All Java series →
SERIESbeginner

Python for Java Developers

Learn Python fast by building on the Java you already know. Each part takes one Python idea, gives you one quick Java comparison to anchor it, then teaches it in plain Python, with the traps a Java mind falls into. Short, practical, and aimed at the Python you meet in real AI code.

13 PARTS · ABOUT 63 MIN