- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
Max of Min for Every Window Size | GeeksforGeeks GFG Solution in C++ | Monotonic Stack | DSA
In this video, we solve the GeeksforGeeks problem "Max of Min for Every Window Size" using an efficient Monotonic Stack approach in C++.
🔗 Problem Link:
https://www.geeksforgeeks.org/problems/maximum-of-minimum-for-every-window-size3453/1?sortBy=submissions&category[]=Stack&page=1&difficulty[]=2
📌 Problem Statement:
You are given an integer array arr.
Your task is to find the maximum of minimum values for every window size k where:
1 ≤ k ≤ arr.size()
👉 For every window size:
Find minimum element of all subarrays of size k
Among those minimums, choose the maximum value
Return the result array where index i stores answer for window size i+1.
📌 Example:
Input:
arr = [10, 20, 30, 50, 10, 70, 30]
Output:
[70, 30, 20, 10, 10, 10, 10]
Explanation:
Window size 1
Minimums = [10, 20, 30, 50, 10, 70, 30]
Maximum of minimums = 70
Window size 2
Minimums = [10, 20, 30, 10, 10, 30]
Maximum of minimums = 30
Window size 3
Minimums = [10, 20, 10, 10, 10]
Maximum of minimums = 20
Window size 4 to 7
Maximum of minimums = 10
📌 Approach Used in This Video:
✔ Use Previous Smaller Element and Next Smaller Element
✔ Find the window size where each element becomes minimum
✔ Store maximum values for corresponding window lengths
✔ Fill remaining answers using backward traversal
✔ Efficient monotonic stack optimization
The main idea is:
For every element, determine the largest window where it can act as the minimum element.
📌 Complexity:
Time Complexity: O(n)
Space Complexity: O(n)
🎯 In this video you will learn:
✔ Max of minimum for every window size
✔ Monotonic stack technique
✔ Previous and next smaller element concept
✔ Sliding window optimization
✔ Important hard interview problem on stack
💻 Language Used: C++
📚 Platform: GeeksforGeeks
📂 Topic: Stack / Arrays
Tags:
max of min for every window size gfg, maximum of minimum problem, monotonic stack problem, previous smaller next smaller, sliding window stack problem, gfg stack problems solution, dsa hard problems, coding interview stack questions, geeksforgeeks stack solution, window size minimum maximum c++
#MaxOfMinForEveryWindowSize
#MonotonicStack
#SlidingWindow
#Stack
#GeeksforGeeks
#GFG
#DSA
#CPlusPlus
#CPP
#CodingInterview
#InterviewPreparation
#ProblemSolving
#DSAWithCPP
#GFGSolutions
Видео Max of Min for Every Window Size | GeeksforGeeks GFG Solution in C++ | Monotonic Stack | DSA канала SCIENCE IN FRONT OF YOU
🔗 Problem Link:
https://www.geeksforgeeks.org/problems/maximum-of-minimum-for-every-window-size3453/1?sortBy=submissions&category[]=Stack&page=1&difficulty[]=2
📌 Problem Statement:
You are given an integer array arr.
Your task is to find the maximum of minimum values for every window size k where:
1 ≤ k ≤ arr.size()
👉 For every window size:
Find minimum element of all subarrays of size k
Among those minimums, choose the maximum value
Return the result array where index i stores answer for window size i+1.
📌 Example:
Input:
arr = [10, 20, 30, 50, 10, 70, 30]
Output:
[70, 30, 20, 10, 10, 10, 10]
Explanation:
Window size 1
Minimums = [10, 20, 30, 50, 10, 70, 30]
Maximum of minimums = 70
Window size 2
Minimums = [10, 20, 30, 10, 10, 30]
Maximum of minimums = 30
Window size 3
Minimums = [10, 20, 10, 10, 10]
Maximum of minimums = 20
Window size 4 to 7
Maximum of minimums = 10
📌 Approach Used in This Video:
✔ Use Previous Smaller Element and Next Smaller Element
✔ Find the window size where each element becomes minimum
✔ Store maximum values for corresponding window lengths
✔ Fill remaining answers using backward traversal
✔ Efficient monotonic stack optimization
The main idea is:
For every element, determine the largest window where it can act as the minimum element.
📌 Complexity:
Time Complexity: O(n)
Space Complexity: O(n)
🎯 In this video you will learn:
✔ Max of minimum for every window size
✔ Monotonic stack technique
✔ Previous and next smaller element concept
✔ Sliding window optimization
✔ Important hard interview problem on stack
💻 Language Used: C++
📚 Platform: GeeksforGeeks
📂 Topic: Stack / Arrays
Tags:
max of min for every window size gfg, maximum of minimum problem, monotonic stack problem, previous smaller next smaller, sliding window stack problem, gfg stack problems solution, dsa hard problems, coding interview stack questions, geeksforgeeks stack solution, window size minimum maximum c++
#MaxOfMinForEveryWindowSize
#MonotonicStack
#SlidingWindow
#Stack
#GeeksforGeeks
#GFG
#DSA
#CPlusPlus
#CPP
#CodingInterview
#InterviewPreparation
#ProblemSolving
#DSAWithCPP
#GFGSolutions
Видео Max of Min for Every Window Size | GeeksforGeeks GFG Solution in C++ | Monotonic Stack | DSA канала SCIENCE IN FRONT OF YOU
Комментарии отсутствуют
Информация о видео
25 мая 2026 г. 22:40:12
00:00:50
Другие видео канала





















