Java Interview Programming Questions for 8+ Years Experienced Developers
This guide consolidates commonly reported Java programming questions from interview experiences shared on Glassdoor and similar platforms, focusing on candidates with around 8 years of experience.
Common String Problems
Section titled “Common String Problems”Frequently asked problems include:
- Reverse each word in a sentence
- Find character frequency using
HashMap - Check whether two strings are anagrams
- Longest substring without repeating characters
- First non-repeating character
- String and number palindrome
- Generate all permutations of a string
- String compression (
aabcc -> a2b1c2) - Convert a string to an integer without
Integer.parseInt()
Reported examples include reversing words in a sentence and character frequency counting.
Number-Based Problems
Section titled “Number-Based Problems”Common questions:
- Armstrong number
- Prime number (optimized)
- Fibonacci (iterative, recursive, DP)
- Factorial
- Fast exponentiation
- Palindrome number
- Count digits / sum of digits
- Missing number in an array
Array Problems
Section titled “Array Problems”High-priority topics:
- Two Sum / Three Sum
- Find duplicates without extra space
- Longest consecutive sequence
- Kadane’s Algorithm
- Rotate array
- Merge sorted arrays
- Kth largest element
- Stock buy/sell
- Subarray with given sum
HashMap and Collections
Section titled “HashMap and Collections”Senior-level collection problems include:
- Character frequency
- LRU Cache
- Custom HashMap
- First duplicate
- Group anagrams
- Sort map by values
- Cycle detection
Linked List
Section titled “Linked List”Typical questions:
- Reverse linked list
- Detect cycle (Floyd’s algorithm)
- Merge sorted lists
- Find middle node
- Remove Nth node from end
- Clone linked list with random pointer
Stack and Queue
Section titled “Stack and Queue”- Valid parentheses
- Min Stack
- Queue using stacks
- Next greater element
- Sliding window maximum
Multithreading and Concurrency
Section titled “Multithreading and Concurrency”Very common for experienced developers:
- Print odd/even using two threads
- Producer-Consumer
- Thread-safe Singleton
- Deadlock creation and resolution
- Custom blocking queue
flowchart LR
A[Producer] -->|enqueue| B[Blocking Queue]
B -->|dequeue| C[Consumer]
Interviewers often ask follow-up questions about synchronization, memory visibility, locking, and scalability.
Java 8+ Functional Programming
Section titled “Java 8+ Functional Programming”Expected Stream API exercises:
- Find duplicates
- Group by property
- Frequency counting
- Object sorting
- Convert list to map
- Flatten nested collections
Design-Oriented Coding
Section titled “Design-Oriented Coding”Senior candidates are commonly asked to implement:
- LRU Cache
- Rate Limiter
- Parking Lot
- Thread Pool
- In-memory Cache
Pattern and Matrix Problems
Section titled “Pattern and Matrix Problems”- Star patterns
- Spiral matrix
- Rotate matrix
- Search in sorted matrix
Company-Specific Examples
Section titled “Company-Specific Examples”| Company | Reported Coding Topics |
|---|---|
| Oracle | Closest palindrome |
| JPMorgan | Concurrency, locking |
| Publicis Sapient | Longest consecutive sequence |
| Amdocs/Cognizant | Core Java + coding exercise |
What Changes for 8+ Years
Section titled “What Changes for 8+ Years”Senior interviews typically emphasize:
- Time and space optimization
- Clean, maintainable code
- Concurrency correctness
- Practical backend design
Typical interview structure:
flowchart TD
A[Coding Round] --> B[Solution Discussion]
B --> C[Optimization]
C --> D[Concurrency Follow-up]
D --> E[System Design Discussion]
Common follow-up questions:
- Make it thread-safe.
- Reduce memory usage.
- Handle millions of requests.
- Improve time complexity.
Top 20 Must-Prepare Problems
Section titled “Top 20 Must-Prepare Problems”- LRU Cache
- Longest substring without repeating characters
- Two Sum / K Sum
- Reverse linked list
- Detect cycle in linked list
- Producer-Consumer
- Odd-even thread printing
- Character frequency using HashMap
- Group anagrams
- Longest consecutive sequence
- Kadane’s Algorithm
- Sliding window maximum
- Valid parentheses
- Merge intervals
- Custom comparator sorting
- Java Streams transformations
- Thread-safe Singleton
- Blocking queue
- String permutations
- Closest palindrome
Key Takeaways
Section titled “Key Takeaways”- Senior Java interviews focus on optimization, concurrency, and practical design in addition to coding.
- Arrays, collections, multithreading, and Java Streams are consistently emphasized.
- Expect follow-up discussions around scalability, thread safety, and production-quality implementation.
- Preparing the top 20 problems provides strong coverage for many backend Java interviews.