Grumpy Bookstore Owner
A medium-tier problem at 64% community acceptance, tagged with Array, Sliding Window. Reported in interviews at Nutanix and 1 others.
Grumpy Bookstore Owner is a medium-difficulty sliding-window problem that looks deceptively simple but trips up candidates who don't spot the pattern. Nutanix and Walmart Labs have both asked this. You're given an array of customer grumpiness scores and a budget. The trick isn't brute force iteration, it's recognizing that you need to find the contiguous subarray where you can buy books for the most customers without exceeding your budget. Acceptance sits at 64%, which means the window-based approach is not obvious to everyone who sees it. StealthCoder solves this invisibly if you blank on the sliding-window setup during the live OA.
Companies that ask "Grumpy Bookstore Owner"
Grumpy Bookstore Owner 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. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop.
Get StealthCoderThe naive approach is checking every possible contiguous segment, which leads to O(n2) and fails on medium-sized inputs. The real solution uses a two-pointer sliding window: expand right while adding costs, shrink left when you exceed budget, track the max window size. The gotcha is state management, keeping your pointers honest and not double-counting customers. Most candidates either overcomplicate the window logic or miss that you're maximizing window size, not minimizing cost. The Array and Sliding Window topics confirm this is about iteration discipline, not dynamic programming or hash tables. If you're stuck during assessment, StealthCoder reads your problem and delivers a working window implementation in seconds, unseen by the proctor.
Pattern tags
You know the problem.
Make sure you actually pass it.
Grumpy Bookstore Owner recycles across companies for a reason. It's medium-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. Built by an Amazon engineer who used it to pass JPMorgan's OA and system design loop. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Grumpy Bookstore Owner interview FAQ
How hard is this compared to typical sliding-window problems?+
It's solidly medium. The 64% acceptance rate is lower than beginner sliding windows because the constraint interpretation trips people up. You're not sliding to find a specific sum or substring, you're maximizing contiguous customers within a budget. Once you reframe it that way, the two-pointer pattern clicks.
Is this still asked at major companies?+
Yes. Nutanix and Walmart Labs have both reported it. It's not an obscure problem, so it's worth drilling before your OA. It's the kind of medium that shows up in real assessment pipelines.
What's the trick I'm missing?+
Most candidates think they need to track every purchase or optimize spending. The trick is simpler: use a fixed two-pointer window that expands right and shrinks left. You're counting people, not minimizing dollars. The window size itself is your answer.
How does this relate to Array and Sliding Window topics?+
Array is the surface structure, Sliding Window is the solution technique. You iterate through an array with a shrinking/expanding window, tracking what's inside. It's the textbook use case for the pattern.
What's the time complexity I should aim for?+
O(n) with a single pass using two pointers. Each element enters and leaves the window once. Anything O(n2) won't pass medium-sized test cases. Space is O(1) if you're not counting the input array.
Want the actual problem statement? View "Grumpy Bookstore Owner" on LeetCode →