Microsoft Java Interview Questions 2026
Published July 22, 2026 · Updated July 22, 2026
5 real Java interview questions asked at Microsoft. Upvoted by engineers who cleared the loop. Covers Technical, Screening rounds.
5 questions
154 engineers asked
231 upvotes
Company: Microsoft
Technology: Java
All Java Questions Asked at Microsoft
Microsoft
Medium
Technical round
JavaC#Python
Given a binary tree, print nodes level by level (BFS traversal). Then modify it to print alternate levels in reverse order (zigzag traversal). Analyse time and space complexity.
↑ 61 upvotes · 40 engineers asked this · SDE1
Microsoft
Hard
Technical round
JavaPythonC#
Given a 2D grid of 0s and 1s, count the number of islands. Then extend: find the largest island, and then explain how you would solve this for a streaming grid that changes in real time using a Union-Find structure.
↑ 54 upvotes · 34 engineers asked this · SDE2
Microsoft
Easy
Screening round
JavaC#Python
Find all pairs in an array that sum to a given target value. Explain the HashSet approach for O(n) time, handle duplicate pairs correctly, and discuss edge cases (negative numbers, empty array).
↑ 55 upvotes · 37 engineers asked this · SDE1
Microsoft
Medium
Technical round
2-5 yearsJavaC++
Design a data structure that supports insert, delete, and getRandom in O(1) average time. Walk through your approach.
↑ 42 upvotes · 33 engineers asked this · Senior SDE
Microsoft
Medium
Technical round
2-5 yearsJava
Rewrite this imperative loop using Java Streams: filter a list of orders for status "PAID", then sum their amounts. Explain one case where a stream would actually perform worse than the loop.
↑ 19 upvotes · 10 engineers asked this · Senior SDE
Practice these questions with AI feedback
Get instant grading on your answers, identify your weak areas, and generate a personalised 14-day study plan — all free.
Build my study plan →
More Microsoft Questions
Java Questions at Other Companies
Browse by company
Frequently asked questions
Given a binary tree, print nodes level by level (BFS traversal). Then modify it to print alternate levels in reverse order (zigzag traversal). Analyse time and space complexity.
Given a binary tree, print nodes level by level (BFS traversal). Then modify it to print alternate levels in reverse order (zigzag traversal). Analyse time and space complexity.
Given a 2D grid of 0s and 1s, count the number of islands. Then extend: find the largest island, and then explain how you would solve this for a streaming grid that changes in real time using a Union-Find structure.
Given a 2D grid of 0s and 1s, count the number of islands. Then extend: find the largest island, and then explain how you would solve this for a streaming grid that changes in real time using a Union-Find structure.
Find all pairs in an array that sum to a given target value. Explain the HashSet approach for O(n) time, handle duplicate pairs correctly, and discuss edge cases (negative numbers, empty array).
Find all pairs in an array that sum to a given target value. Explain the HashSet approach for O(n) time, handle duplicate pairs correctly, and discuss edge cases (negative numbers, empty array).
Design a data structure that supports insert, delete, and getRandom in O(1) average time. Walk through your approach.
Design a data structure that supports insert, delete, and getRandom in O(1) average time. Walk through your approach.
Rewrite this imperative loop using Java Streams: filter a list of orders for status "PAID", then sum their amounts. Explain one case where a stream would actually perform worse than the loop.
Rewrite this imperative loop using Java Streams: filter a list of orders for status "PAID", then sum their amounts. Explain one case where a stream would actually perform worse than the loop.