2. Java Basics for DSA

Arrays, Strings, StringBuilder and Collections — the Java toolbox every later topic uses.

Your progress0 of 10
9easy
1medium
0hard

Understand the topic

Before patterns, you need to be fast with Java's toolbox: fixed-size arrays (int[]), Strings (immutable), StringBuilder (for building text), and Collections like ArrayList, HashMap and HashSet.

These problems each practise one tool. Pay attention to the small Java details interviewers notice: arrays can't grow, String comparison uses equals(), and StringBuilder avoids creating a new string on every +.

#ProblemPatternLevel
1 Concatenation of Array #1929 Array basics Easy LeetCode ↗
2 Shuffle the Array #1470 Index arithmetic Easy LeetCode ↗
3 Fizz Buzz #412 Strings & List Easy LeetCode ↗
4 Reverse String #344 Two pointers Easy LeetCode ↗
5 Defanging an IP Address #1108 StringBuilder Easy LeetCode ↗
6 Maximum Number of Words Found in Sentences #2114 String scanning Easy LeetCode ↗
7 Kids With the Greatest Number of Candies #1431 Array & List Easy LeetCode ↗
8 Shuffle String #1528 char[] basics Easy LeetCode ↗
9 Count Items Matching a Rule #1773 List of lists Easy LeetCode ↗
10 Insert Delete GetRandom O(1) #380 ArrayList + HashMap Medium LeetCode ↗

Work top to bottom — each list goes from easy to hard. Try a problem for at least 15 minutes before opening a hint. Ticks are saved in your browser.