← All problemsSign in

Special Fruit Tree

There exists a unique tree in Rahul’s farm that bears Apples and Bananas as its fruits. This tree bear fruits in accordance with the following rules : 1. Every fruit has two children. 2. The first child of Banana is a Banana and the second child is an Apple. 3. The first child of Apple is an Apple and second child is a Banana. 4. All the generations of Apples and Bananas start with an Apple

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start