- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
LeetCode 1372|Longest ZigZag Path in Binary Tree | DFS (Step-by-Step)
In this video, I have explained LeetCode 1372.
The goal is to find the longest ZigZag path in a binary tree.
In this video, I have used a DFS approach with direction tracking to compute the longest ZigZag path efficiently.
🧠 Concepts Covered
1. Binary Tree Traversal (DFS)
2. Recursion
3. Direction Tracking (Left ↔ Right)
4. Path Length Calculation
5. Global Maximum Update
⏱ Time Complexity: O(N)
📦 Space Complexity: O(H) (H = height of tree)
This is an important problem to understand how to manage states during recursion in tree problems.
🔗 Stay connected with me:
LinkedIn: https://www.linkedin.com/in/asmitamhetre3183/
LeetCode: https://leetcode.com/u/asmita3183/
👉 Don’t forget to like, share, and subscribe.
Your feedback means a lot! 🙌
#leetcode #leetcode1372 #dsa #datastructures #algorithms #coding #codinginterview
#programming #cpp #binarytree #trees #dfs #recursion #learncoding
#developerlife #softwareengineering #techcareer #placements #codingjourney #interviewprep
Видео LeetCode 1372|Longest ZigZag Path in Binary Tree | DFS (Step-by-Step) канала Asmita Mhetre
The goal is to find the longest ZigZag path in a binary tree.
In this video, I have used a DFS approach with direction tracking to compute the longest ZigZag path efficiently.
🧠 Concepts Covered
1. Binary Tree Traversal (DFS)
2. Recursion
3. Direction Tracking (Left ↔ Right)
4. Path Length Calculation
5. Global Maximum Update
⏱ Time Complexity: O(N)
📦 Space Complexity: O(H) (H = height of tree)
This is an important problem to understand how to manage states during recursion in tree problems.
🔗 Stay connected with me:
LinkedIn: https://www.linkedin.com/in/asmitamhetre3183/
LeetCode: https://leetcode.com/u/asmita3183/
👉 Don’t forget to like, share, and subscribe.
Your feedback means a lot! 🙌
#leetcode #leetcode1372 #dsa #datastructures #algorithms #coding #codinginterview
#programming #cpp #binarytree #trees #dfs #recursion #learncoding
#developerlife #softwareengineering #techcareer #placements #codingjourney #interviewprep
Видео LeetCode 1372|Longest ZigZag Path in Binary Tree | DFS (Step-by-Step) канала Asmita Mhetre
Комментарии отсутствуют
Информация о видео
2 апреля 2026 г. 21:01:05
00:14:20
Другие видео канала





















