CSES Bit Strings | From O(n) Loop to Binary Exponentiation (Iterative Explained)
Автор: Tutorial2Heaven
Загружено: 2026-01-18
Просмотров: 7
In this video, we solve the Bit Strings problem from CSES step by step.
First, I explain the straightforward O(n) approach by repeatedly multiplying by 2 under modulo.
Then, we optimize it using Binary Exponentiation and discuss:
Why time complexity matters for large n
How binary exponentiation reduces it to O(log n)
Why the iterative version is better than recursion (no recursion stack, safer, faster)
This video focuses on clear intuition + clean implementation, exactly what you need for competitive programming and interviews.
00:00 Problem Statement
00:21 Intuition Explained
01:10 O(n) Solution Implementation
02:31 Binary Exponentiation Intuition
05:34 Implementing Binary Exponentiation
07:12 Dry Run Binary Exponentiation
09:40 Iterative vs Recursive (Why Iterative Wins)
#CSES #BitStrings #BinaryExponentiation #CompetitiveProgramming
#DSA #ModularArithmetic #CP #Algorithms
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: