Jump Game VI | Live Coding with Explanation | Leetcode - 1696

preview_player
Показать описание
Detailed explanation for Jump Game VI leetcode problem.
All parts solved. check it out.

0:00 Problem Statement
0:40 Understanding the problem
1:34 Meaning of Jump
6:45 Code using Priority Queue
11:36 Optimization

To support us you can donate

Check out our other popular playlists:
Questions you might like:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

In the Priority Queue solution the space complexity can go up to O(N) and the Time Complexity is also effected by that.
If you try this test case

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
3

and print the size of the Priority Queue at each iteration, then you will find that the size is constantly increasing.
It is because the out of bound elements will not always be at the top of the pq. So
while ( i - pq.peek()[0] > k) {
pq.remove();
}
will not be able to remove elements that are not useful.

I love your explanations. Your channel is really helpful for learners like me and many others. Waiting for you to cross 100K.

ujjalsaha
Автор

Cant you use simple methods like pop() and push()? Worst coding explanation ever

smartswaggy
visit shbcf.ru