LeetCode 2415 Reverse Odd Levels of Binary Tree | Level Order | Asked in J P Morgan , Microsoft

  Рет қаралды 312

Code Harmony

Code Harmony

Күн бұрын

Пікірлер: 3
@deepaksurya2078
@deepaksurya2078 6 күн бұрын
do we do a level-order traveresal, store items at each level in an array, reverse the arrays in odd indices and finally merge all item to a new array?
@CodeHarmonydev
@CodeHarmonydev 6 күн бұрын
Yes , correct
@CodeHarmonydev
@CodeHarmonydev 6 күн бұрын
Reverse the array wont be the correct statement, in short we are trying to make array sorted by utilising swap operations. Given an array , do minimum number of swap operations on any two Indus to make the array sorted. This becomes our hidden problem inside this question. And the approach that we have to follow is to a rate over the array, and try to bring the exact value at the particular index. If the value is already correct, we don’t require a swap else we require one swap. I hope you got more clarity on this now . Let me know.
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
VIP ACCESS
00:47
Natan por Aí
Рет қаралды 30 МЛН
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Reverse Odd Levels of Binary Tree | Leetcode
13:03
Ethos Typos
Рет қаралды 123
The Dome Paradox: A Loophole in Newton's Laws
22:59
Up and Atom
Рет қаралды 1,2 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН