Piles of Boxes
Reported by candidates from BNP's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.
BNP sent you "Piles of Boxes" in September 2024, and it's a simulation problem disguised as a logistics puzzle. You're likely moving items between piles with specific constraints, and the gotcha is tracking state correctly across multiple operations. This is the kind of problem where off-by-one errors and missed edge cases sink candidates. StealthCoder reads the exact problem statement on your screen and gives you the pattern in real time, so you're not flying blind when you sit down.
Pattern and pitfall
Piles of Boxes is a state-machine simulation. You'll be given operations like "move X items from pile A to pile B" or "remove top N items," and you need to track the final configuration. The trick is not the algorithm, it's the bookkeeping. Most candidates either miss capacity constraints, forget to handle empty piles, or misread the operation order. Write out the state after each step on paper first. Use a simple data structure, array or stack per pile, and don't over-engineer. The common pitfall is trying to optimize before you even pass the examples. Get it working, then optimize. StealthCoder catches the moment you misread an operation, so you can backtrack before wasting 20 minutes.
The honest play: practice the pattern, and have StealthCoder ready for the one you didn't see coming.
You can drill Piles of Boxes 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. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play.
Get StealthCoderRelated leaked OAs
You've seen the question.
Make sure you actually pass BNP's OA.
BNP reuses patterns across OAs. Built for the candidate who saw this exact problem leak two days before his OA and wondered if anyone had a play. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Piles of Boxes FAQ
Is this actually a hard problem or just tedious?+
It's tedious with a readability trap. The algorithm is straightforward, but the problem statement is dense. You'll spend more time understanding the operation syntax than coding. Read the examples three times before you write a line.
What's the main gotcha BNP is testing for?+
Attention to detail and state management under multiple constraints. They want to see if you carefully track pile contents, respect limits, and handle edge cases like empty piles or invalid moves without crashing.
Should I use a stack or an array for each pile?+
Stack if you're always taking from the top. Array if the problem lets you remove from arbitrary positions. Check the examples. Both work, so pick whichever you're fastest with and stick with it.
How do I prepare in 48 hours?+
Don't memorize solutions. Instead, practice one simulation problem like Robot Room Cleaner or Tic-Tac-Toe on LeetCode. Focus on writing clean state-tracking code with clear variable names. That's 70 percent of the battle here.
Will this problem time out if I'm not optimal?+
Unlikely. Most simulation problems are O(N) or O(N log N) and the constraints are usually small. A straightforward solution without premature optimization will pass. Focus on correctness first, speed second.