HARDasked at 1 company

Cut Off Trees for Golf Event

A hard-tier problem at 35% community acceptance, tagged with Array, Breadth-First Search, Heap (Priority Queue). Reported in interviews at Flipkart and 0 others.

Founder's read

You're looking at a problem Flipkart has actually asked. It sits at the hard level with a 35% acceptance rate, which means most candidates who see it live don't solve it cleanly. The trap is treating this like a simple grid traversal when it's really about finding the minimum time to cut down all trees in a specific order. You can brute-force a path through the matrix, or you can miss the optimization and time out. StealthCoder runs invisibly during your assessment and surfaces the working solution the moment you hit a wall on the ordering logic.

Companies asking
1
Difficulty
HARD
Acceptance
35%

Companies that ask "Cut Off Trees for Golf Event"

If this hits your live OA

Cut Off Trees for Golf Event 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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

The core trick is that you must cut trees in order of their height, shortest first. A naive BFS from tree to tree works in theory but explodes with poor state management. The real solution combines a priority queue to sort trees by height, then uses BFS to find the shortest distance between consecutive trees on your cutting route. Most candidates either skip the heap entirely and time out, or they implement BFS incorrectly for a graph that lives on a matrix. The pattern sits at the intersection of Array, Breadth-First Search, Heap, and Matrix work, which is why it punches above its weight. If you haven't drilled this exact combination, StealthCoder is the safety net that gives you a working implementation in seconds so you don't burn 30 minutes on the assessment.

Pattern tags

The honest play

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

Cut Off Trees for Golf Event recycles across companies for a reason. It's hard-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 an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Cut Off Trees for Golf Event interview FAQ

Is this problem really asked at Flipkart in live OAs?+

Yes. Flipkart is the only company in the data for this problem, and it's marked hard. It's not common across many firms, which means prep resources and solutions are sparse. That scarcity is exactly why a live safety net matters.

What's the trick most candidates miss?+

They treat it as a simple pathfinding problem and forget that trees must be cut in height order. They also implement BFS poorly or skip the heap altogether. The winning approach uses a min-heap to sort trees by height, then BFS between each pair.

How does the heap connect to matrix traversal here?+

The heap sorts the trees once. For each tree in sorted order, you run BFS on the matrix to find the shortest path to the next tree. The heap controls the problem's logical flow; BFS solves the spatial part.

Why is the acceptance rate so low at 35%?+

The problem requires understanding four separate concepts and how they fit together. Most candidates get one or two right but fumble the integration. Hard problems at 35% acceptance are typically gatekeepers designed to separate solid engineers from the rest.

Can I solve this with just BFS and no heap?+

Not efficiently. BFS alone solves pathfinding, but it doesn't enforce the tree-height ordering constraint. You need the heap to sort, then BFS to measure distances. Skip the heap and you'll either get wrong answers or time out.

Want the actual problem statement? View "Cut Off Trees for Golf Event" 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.