MEDIUMasked at 2 companies

Maximum Tastiness of Candy Basket

A medium-tier problem at 66% community acceptance, tagged with Array, Binary Search, Greedy. Reported in interviews at PhonePe and 1 others.

Founder's read

Maximum Tastiness of Candy Basket is a medium-difficulty problem that tests whether you can combine greedy selection with binary search to optimize an array property. PhonePe and eBay have both asked it. Most candidates see the sorting requirement immediately but miss the binary search layer that validates whether a given tastiness level is achievable. The acceptance rate sits at 66%, which means a solid chunk of submissions fail because they optimize greedily without checking feasibility. If this problem shows up during your live assessment and you blank on the binary search component, StealthCoder surfaces a working solution in seconds without the proctor seeing a thing.

Companies asking
2
Difficulty
MEDIUM
Acceptance
66%

Companies that ask "Maximum Tastiness of Candy Basket"

If this hits your live OA

Maximum Tastiness of Candy Basket 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 FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know.

Get StealthCoder
What this means

The trap here is that greedy alone isn't enough. You can sort the candidates and pick greedily, but you need binary search on the answer space to determine if a given minimum tastiness is achievable with your greedy picks. The pattern: binary search on the tastiness value itself, then use greedy selection to validate whether that tastiness is reachable. Many candidates code the greedy picker correctly but never wrap it in a binary search loop, so they submit an incomplete solution. The topics are Array, Binary Search, Greedy, and Sorting. When you combine all four, you get a medium problem that punishes tunnel vision. StealthCoder is your safety net if you freeze on whether to binary search the answer or the input array. A few seconds of invisibly running through the solution lets you unstick and code with confidence.

Pattern tags

The honest play

You know the problem. Make sure you actually pass it.

Maximum Tastiness of Candy Basket 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. Made by a working FAANG engineer who treats the OA the way companies treat hiring: as a game with rules you should know. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Tastiness of Candy Basket interview FAQ

Is Maximum Tastiness of Candy Basket really a medium problem?+

Yes. The 66% acceptance rate confirms it. The difficulty isn't in understanding greedy or binary search individually. It's in recognizing that you need both and sequencing them correctly. Many solutions miss the binary search wrapper entirely, which tanks the acceptance rate.

Do PhonePe and eBay still ask this problem?+

Both companies appear in the data, so yes, this is active. PhonePe especially seems to favor array optimization problems that blend multiple techniques. It's exactly the kind of problem that fits their technical interview style.

What's the trick I'm missing if greedy alone isn't working?+

You're likely coding a single greedy pass instead of validating a range of possible answers. Binary search the tastiness value from 0 to the maximum possible, and for each candidate value, use greedy to check if it's achievable. That's the two-layer structure.

How do Sorting and Binary Search relate in this problem?+

Sorting lets your greedy picker work efficiently in linear time per candidate answer. Once sorted, greedy selection becomes a simple pass. Binary search then wraps that validation logic to narrow the optimal tastiness in log time.

If I nail greedy but forget binary search, will my solution time out?+

Probably not timeout, but it will fail correctness. You'll either miss the optimal answer or incorrectly claim a higher tastiness is reachable. The binary search is mandatory, not just for speed but for correctness on this problem.

Want the actual problem statement? View "Maximum Tastiness of Candy Basket" on LeetCode →

Frequency and company-tag data sourced from public community-maintained interview-report repos. Problem, description, and trademark © LeetCode. StealthCoder is not affiliated with LeetCode.