Minimum Non-Adjacent Selection Capability
Reported by candidates from Microsoft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
The detail that matters in this Microsoft OA, reported October 2026, is that you must pick at least count non-adjacent positions and minimize the largest value you pick. That's a min-max problem, and min-max with a monotonic yes/no check means binary search on the answer. It's the same shape as House Robber IV. The array can hit 10^5 elements and values reach 10^9, so brute force dies fast. If you blank on the setup, StealthCoder runs invisibly during the live assessment and can hand you the approach. Know the trick first, though. It's short.
The problem
You are given an array of positive integers values. Choose at least count positions so that no two chosen positions are adjacent. The capability of a selection is the maximum value among its chosen positions. Return the minimum capability achievable by any valid selection. Function minimumSelectionCapability(values: int[], count: int) → int Examples Example 1 values = [2,3,5,9] count = 2 return = 5 Choosing values 2 and 5 from positions 0 and 2 gives capability 5. No valid pair has a smaller maximum. Example 2 values = [2,7,9,3,1] count = 2 return = 2 Positions 0 and 4 are non-adjacent and hold values 2 and 1, so the minimum capability is 2. Example 3 values = [10,1,8,2,7,3] count = 3 return = 3 Choosing positions 1, 3, and 5 gives values 1, 2, and 3. Constraints 1 <= values.length <= 10^5. 1 <= values[i] <= 10^9. 1 <= count <= (values.length + 1) / 2.
Reported by candidates. Source: FastPrep
Pattern and pitfall
Binary search on the capability. Pick a candidate cap X and ask: can I choose at least count non-adjacent positions, all with value <= X? Check it greedily. Scan left to right, and whenever values[i] <= X, take it and skip i+1. Greedy works because taking the earliest eligible position never hurts later choices. If the taken count reaches count, X is feasible. Feasibility is monotonic, since a bigger X only adds options. Search between the min and max of the array, or just 1 to 10^9. Total cost is O(n log(maxValue)). The common pitfall is reaching for DP with a max-of-selection state, which gets messy and slow. Another is forgetting to skip the neighbor after a pick, or searching over indexes instead of values. If the live OA rattles you, StealthCoder is the safety net that surfaces this binary search plus greedy check so you can still submit clean code.
Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.
You can drill Minimum Non-Adjacent Selection Capability cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.
Get StealthCoderRelated leaked OAs
This OA pattern shows up on LeetCode as house robber iv. If you have time before the OA, drill that.
You've seen the question.
Make sure you actually pass Microsoft's OA.
Microsoft reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Minimum Non-Adjacent Selection Capability FAQ
What's the trick in the Microsoft Minimum Non-Adjacent Selection Capability problem?+
Binary search on the answer, not on indexes. Guess a max value X, then greedily count how many non-adjacent elements are <= X. If you reach count, X works, so try smaller. If not, go bigger. The greedy check is a single linear pass.
Why does the greedy feasibility check work?+
Taking the earliest eligible element and skipping its neighbor leaves the most room for the rest of the array. Any optimal selection can be swapped to include that earlier pick without losing count. So the greedy count is the true maximum for that cap.
What's the time complexity I should state?+
O(n log M), where n is the array length and M is the value range, up to 10^9. That's roughly 30 passes over 10^5 elements, which is easily fast enough. Space is O(1). Say that out loud if the interviewer asks.
Is this pattern still asked in 2026 OAs?+
Yes. Binary search on the answer with a greedy check shows up constantly in min-max and capacity-style questions. This one was reported at Microsoft in October 2026. If you can write the feasibility function cleanly, you can solve most of this family.
How do I prepare for this in 48 hours?+
Write this one from scratch twice. Then do two or three other binary-search-on-answer problems, like capacity or minimum-speed variants. Focus on the template: lo, hi, feasible(mid), shrink. Test edge cases like count equal to 1 and a length-1 array.