CSES Two Knights Explained | My Own Mathematical Derivation
Автор: Tutorial2Heaven
Загружено: 2026-01-07
Просмотров: 54
In this video, I solve the Two Knights problem from the CSES Problem Set using a non-standard mathematical derivation.
Most explanations rely on visual 2×3 or 3×2 board intuition.
In this video, I avoid that completely and derive the attacking knight count purely by analyzing knight moves and symmetry, leading directly to:
Attacking pairs = 4(𝑘−1)(𝑘−2)
This approach is more formula-driven, easier to generalize, and avoids memorizing patterns.
🔍 What this video covers:
1)Counting total ways to place 2 knights
2)Systematic counting of attacking knight pairs
3)Why the expression simplifies to 4(k−1)(k−2)
4)Final closed-form solution in O(1) time
5)Clean logic suitable for interviews and contests
⏱️ Timestamps:
00:00 Problem overview
00:30 Total knight placements
03:09 Observing attacking moves
07:34 Counting attacks systematically
08:00 Deriving 4(k−1)(k−2)
10:03 C++ implementation
#CSES #TwoKnights #MathDerivation #CompetitiveProgramming
#DSA #CPMath #CodingInterview #ChessKnights
#Codeforces #CodeChef
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: