Kth Missing Positive Number
A easy-tier problem at 62% community acceptance, tagged with Array, Binary Search. Reported in interviews at TikTok and 4 others.
Kth Missing Positive Number is the problem that sounds trivial until you realize the naive approach fails on the actual test cases. You're given a sorted array of positive integers with gaps, and you need to find the kth number that's missing from the sequence. TikTok, Meta, and Morgan Stanley ask this regularly. Most candidates iterate through the array counting gaps, which works but burns time on larger inputs. The real trick is binary search on the answer space itself, not the array. If you haven't drilled the binary search variant, StealthCoder surfaces a working solution in seconds during the live assessment.
Companies that ask "Kth Missing Positive Number"
Kth Missing Positive Number is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE.
Get StealthCoderThe brute-force scan through the array works fine for small k, but the binary search approach is what separates a pass from a stall. The insight is that you can binary search on the missing number directly: if you know how many numbers are missing up to value x, you can ask 'is the kth missing number at or before x?' and tighten your bounds. The gap at index i is (array[i] - (i + 1)). Common pitfall: candidates waste 10 minutes on the linear scan, then get nervous when time pressure hits. Array and Binary Search are both involved, which trips people up initially because they expect Array problems to stay linear. If this pattern doesn't click during your prep, StealthCoder runs invisibly during the OA and delivers the binary search solution when you're stuck.
Pattern tags
You know the problem.
Make sure you actually pass it.
Kth Missing Positive Number recycles across companies for a reason. It's easy-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Made by a working Amazon engineer who got tired of watching qualified friends bomb OAs they'd solve cold in an IDE. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Kth Missing Positive Number interview FAQ
Is this problem actually easy, or is the 62% acceptance rate misleading?+
The acceptance rate suggests the problem is easier than average, but most passes come from the O(n) scan approach. The O(log n) binary search solution is less common in submissions. It's easy if you iterate, medium if you want to do it cleanly. TikTok and Meta candidates report it's more about pattern recognition than pure difficulty.
Do I really need binary search, or is a linear scan fast enough?+
Linear scan works and passes most cases. Binary search is faster, cleaner, and what senior engineers expect. The problem sits in Easy tier partly because the linear solution is accessible. But if the array is large, O(log n) beats O(n). On a timed OA, O(n) gets you the green checkmark faster.
What's the trick I'm missing if I can't get the binary search right?+
The trick is binary searching on the answer, not the index. At each candidate value x, calculate how many positive integers are missing up to x. If the count is less than k, the kth missing number is larger. If it's greater than or equal to k, search lower. That flips the mental model from 'find x in the array' to 'find x such that missing count equals k'.
How does this relate to other Array and Binary Search problems I should know?+
This combines array iteration with binary search logic on a derived property, not direct array access. Similar to 'Search in Rotated Sorted Array' or 'Find First Bad Version' in structure. It's a stepping stone to harder binary search problems that ask you to search on properties instead of values.
Do the big companies that ask this (Meta, TikTok, Morgan Stanley) care which approach I use?+
They care that you solve it correctly first. The binary search solution shows depth. In a real interview, starting with the scan and then optimizing to binary search is actually ideal. The problem is tested so often because both approaches are defensible, and it reveals how candidates think about trade-offs.
Want the actual problem statement? View "Kth Missing Positive Number" on LeetCode →