Software Development Engineer II Interview Questions & Answers
40 questions for Software Development Engineer II interviews — 3 easy, 32 medium, 5 hard.
About the Software Development Engineer II role
An SDE-2 owns features and services end to end, makes design decisions within a team and mentors juniors. Interviews at product companies include two or three DSA rounds with medium to hard problems on graphs, dynamic programming, trees and heaps, a low-level design round and a system design round. Interviewers expect optimal solutions, clean code, edge case handling and clear reasoning about trade-offs.
How do you find the lowest common ancestor in a BST versus in a general binary tree?
Show answer
Compare Kruskal's and Prim's algorithms for minimum spanning trees.
Show answer
Tell me about a time you worked with people from other teams to solve a complex problem.
Show answer
What is the Union-Find data structure and what optimisations make it fast?
Show answer
Compare AVL trees and red-black trees.
Show answer
What is a greedy algorithm and when does it give the optimal answer?
Show answer
Compute the length of the longest common subsequence of two strings.
Show answer
Find the lowest common ancestor of two nodes in a binary tree.
Show answer
A recursive tree traversal crashes on a skewed tree with one million nodes. How do you fix it?
Show answer
A hospital emergency system must treat patients by severity, and patients with equal severity in arrival order. How would you implement it?
Show answer
A game leaderboard with millions of players needs fast score updates and queries like what rank is this player. How would you design it?
Show answer
Solve jump game: can you reach the last index if nums[i] is the maximum jump from i?
Show answer
What is a trie and where is it used?
Show answer
Implement Union-Find with path compression and union by size.
Show answer
Implement Dijkstra's algorithm with a priority queue.
Show answer
Write a function to validate a binary search tree.
Show answer
Implement 0/1 knapsack using a one-dimensional DP array.
Show answer
What is a bipartite graph and how do you check for one?
Show answer
A search box must suggest the closest dictionary words when a user makes a typo. How would you approach it?
Show answer
Implement a data structure that returns the median of all numbers added so far.
Show answer
Find the minimum number of coins needed to make an amount.
Show answer
Solve climbing stairs: how many ways are there to climb n steps taking 1 or 2 steps at a time?
Show answer
In activity selection, why do we sort by end time rather than start time or duration?
Show answer
Explain the recurrence for the 0/1 knapsack problem.
Show answer
How do you recognise a DP problem and define its state?
Show answer
You must build autocomplete for a search box over one million product names. Which data structure would you use?
Show answer
How do you prioritise when several tasks have deadlines at the same time?
Show answer
Merge K sorted linked lists using a min-heap.
Show answer
How can two heaps maintain the running median of a stream?
Show answer
How does heap sort work and how does it compare with quicksort and merge sort?
Show answer
What is topological sorting and how is it done?
Show answer
How do you decide between a greedy approach and dynamic programming?
Show answer
What are the complexities of heap operations, and why does building a heap take O(n)?
Show answer
Tell me about a time you kept working on a hard problem when others had given up.
Show answer
What is edit distance and where is it used?
Show answer
What is the difference between memoisation and tabulation?
Show answer
How do you handle pressure during a timed online coding test?
Show answer
You need to merge K sorted log files from different servers into one sorted output. How would you do it efficiently?
Show answer
How would you generate friend suggestions as friends of friends in a social network?
Show answer
Frequently asked questions
What does a Software Development Engineer II do?
An SDE-2 owns features and services end to end, makes design decisions within a team and mentors juniors. Interviews at product companies include two or three DSA rounds with medium to hard problems on graphs, dynamic programming, trees and heaps, a low-level design round and a system design round. Interviewers expect optimal solutions, clean code, edge case handling and clear reasoning about trade-offs.
Which skills are tested in a Software Development Engineer II interview?
Expect questions on Advanced DSA patterns, Low-level design, Code quality, Ownership, Mentoring. Most rounds also ask you to explain a project and solve one practical problem live.
How do I prepare for a Software Development Engineer II interview?
Revise Graphs and Graph Algorithms, Dynamic Programming, Trees and Binary Search Trees, Heaps, Priority Queues and Greedy first using the topic sheets, practise the questions on this page aloud, then do one full mock interview to practise timing.