Problem #77 MEDIUM

The Landlord and the Tenants

Google Amazon Combinatorics Logic

Problem Statement

A landlord owns an apartment building with 5 floors. Each floor has exactly one flat. He has 5 tenants — Arun, Bina, Chand, Deepa, and Esha. He must assign one tenant per floor. The following conditions apply: Arun refuses to live on the top floor. Bina must live on a higher floor than Chand. Deepa and Esha cannot live on adjacent floors. Esha must live on an odd-numbered floor (1, 3, or 5). How many valid assignments are there?

Answer & Quick Explanation

Think you've got it? Click below to check your answer.

18 valid assignments. Found by casework on Esha's position (floors 1, 3, 5), then applying Deepa-not-adjacent, Arun-not-top, and Bina-above-Chand within each case. Result: 7 (E=1) + 6 (E=3) + 5 (E=5) = 18.

Detailed Editorial Solution

Want to see the step-by-step breakdown? Click below to reveal the editorial.

Use casework on Esha's floor (1, 3, or 5), then apply remaining constraints. The Bina-above-Chand constraint halves the arrangements of those two relative to each other, since exactly one ordering is valid for each pair of floors they occupy. Step 1: Case E=1 (Esha on floor 1): Deepa cannot be on floor 2 (adjacent). Remaining floors for Arun, Bina, Chand, Deepa: {2,3,4,5}. Arun cannot be on floor 5. Deepa cannot be on floor 2. So Deepa is on 3, 4, or 5. Count arrangements where Bina > Chand among {2,3,4,5} minus Deepa's floor, and Arun ≠ 5. Step 2: Deepa on floor 3: remaining {2,4,5} for Arun, Bina, Chand. Arun ≠ 5 → Arun on 2 or 4. Bina > Chand in {2,4,5} minus Arun. For each Arun choice, count Bina-Chand orderings: Arun=2 → B,C on {4,5}: 1 valid (B=5,C=4). Arun=4 → B,C on {2,5}: 1 valid (B=5,C=2). Total for D=3: 2. Step 3: Deepa on floor 4: remaining {2,3,5} for Arun, Bina, Chand. Arun=2→B,C on {3,5}:1 valid. Arun=3→B,C on {2,5}:1 valid. Arun≠5. Total: 2. Step 4: Deepa on floor 5: remaining {2,3,4} for Arun, Bina, Chand. Arun≠5 (satisfied). All 3 floors have Arun options: Arun=2→B,C on {3,4}:1. Arun=3→B,C on {2,4}:1. Arun=4→B,C on {2,3}:1. Total: 3. Case E=1 total: 2+2+3=7. Step 5: Case E=3: Deepa cannot be on floor 2 or 4. Deepa on {1,5}. Apply Arun≠5 and Bina>Chand similarly. Case E=3 total: 6. Step 6: Case E=5: Arun cannot be on floor 5 (Esha is there). Deepa cannot be on floor 4. Apply constraints. Case E=5 total: 5. Grand total: 7+6+5 = 18 valid assignments. Key Insight: Constrained counting rewards applying the most restrictive constraint first to minimise branches. Here Esha's odd-floor constraint creates 3 clean cases. The Bina-above-Chand constraint then acts as a simple divisor — exactly half of all (Bina, Chand) arrangements on any two distinct floors are valid.