LLD - Design — Chess GameWhich of the following conditions must be true for castling to be allowed in a chess game?AThe king is currently in check and moves two squares towards the rook.BNeither the king nor the rook involved has moved before, and no pieces are between them.CThe rook has moved once, but the king has not moved.DThe king moves diagonally two squares towards the rook.Check Answer
Step-by-Step SolutionSolution:Step 1: Understand castling rulesCastling requires that neither the king nor the rook involved has moved before, and the squares between them are empty.Step 2: Check king safety conditionsThe king cannot be in check, nor can it pass through or land on a square under attack during castling.Final Answer:Neither the king nor the rook involved has moved before, and no pieces are between them. -> Option BQuick Check:Castling conditions = Neither the king nor the rook involved has moved before, and no pieces are between them. [OK]Quick Trick: Castling needs unmoved king and rook with clear path [OK]Common Mistakes:MISTAKESAllowing castling when king is in checkIgnoring if rook has movedAllowing king to move diagonally during castling
Master "Design — Chess Game" in LLD9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepArchTryChallengeDesignRecallScale
More LLD Quizzes Advanced LLD Concepts - Domain-Driven Design basics - Quiz 10hard Advanced LLD Concepts - Thread safety in design - Quiz 1easy Advanced LLD Concepts - Code review checklist for LLD - Quiz 2easy Design — Chess Game - Game state management - Quiz 10hard Design — Hotel Booking System - Hotel, Room, Booking classes - Quiz 13medium Design — Hotel Booking System - Availability checking - Quiz 12easy Design — Hotel Booking System - Why booking tests availability and concurrency - Quiz 5medium Design — Online Shopping Cart - Notification on state change - Quiz 10hard Design — Online Shopping Cart - Payment strategy pattern - Quiz 4medium Design — Online Shopping Cart - Product, Cart, Order classes - Quiz 3easy