Minimum Time to Visit a Cell In a Grid | Weekly Contest 334

  Рет қаралды 817

codingMohan

codingMohan

Күн бұрын

Пікірлер: 14
@dawodujohnson
@dawodujohnson Жыл бұрын
how do you know when to apply graph algorithms like dijistra,bfs,dfs, rather than dp? I have seen problems like this solved with dp
@codingmohan
@codingmohan Жыл бұрын
As mentioned in the video, you'll apply DP when there is no loop in the transition path (usually when you're allowed to go "right & down" i.e. you can never come back to original point).
@dawodujohnson
@dawodujohnson Жыл бұрын
@@codingmohan nice! I get it now
@josephaj8310
@josephaj8310 Жыл бұрын
Bro could you post the solution for last problem in geeksforgeeks weekly contest 91.
@SDE-wq4tl
@SDE-wq4tl Жыл бұрын
I got AC using set but TLE using heap, can you please explain why?
@phoenix_1_3
@phoenix_1_3 Жыл бұрын
Yh i too got the same error. I guess it's because in heap, we'll have duplicate cells with different elapsing time. We will take the minimum time from them even though we process (pop & check) all duplicate cells. In set, we won't have duplicate cells. While inserting if the minimum time cell will replace the other cell. So no need of processing them again
@lofibeats2344
@lofibeats2344 Жыл бұрын
In 2nd problem today's leetcode cotest why we are reducing numeric value of the range[0, i] to it's remainder with m?
@codingmohan
@codingmohan Жыл бұрын
Because we can't generate the entire number in the range [0, i] (the largest number you can have with a 64 bit integer is 2^64 - 1). So, if we try to get the actual number, it will overflow and to just determine the divisibility, we really don't need the original number. Therefore, we've taken the modulus. Hope it helps :)
@lofibeats2344
@lofibeats2344 Жыл бұрын
@@codingmohan yeah how was today's contest though?
@codingmohan
@codingmohan Жыл бұрын
@@lofibeats2344 Was good. Last problem was interesting.
@lofibeats2344
@lofibeats2344 Жыл бұрын
@@codingmohan I wanted to say one thing. The way you teach is great but once try to make a video in hindi. Just see once I think your explanation will be more engaging.
@rahulkumarbarik7584
@rahulkumarbarik7584 11 ай бұрын
Anyone Wandering the java code for this amazing explanation !!, Check out this java Code for the above logic //Java Code Starts class Node{ int x; int y; int distance; public Node(int x,int y,int distance){ this.x = x; this.y = y; this.distance = distance; } } class CustomComparator implements Comparator{ @Override public int compare(Node node1,Node node2){ return Integer.compare(node1.distance,node2.distance); } } class Solution { Integer n; Integer m; public boolean isValidate(int x,int y){ if( (x>=0 && x=0 && y1 && grid[1][0]>1) return -1; int[][] time = new int[n][m]; for(int i=0;i newTime){ time[xNew][yNew] = newTime; pq.add(new Node(xNew,yNew,newTime)); } } } } return time[n-1][m-1]; } } //Java Code ends 🙂
Split the Array to Make Coprime Products | Weekly Contest 335
17:19
Minimum Reverse Operations | Weekly Contest 339
39:47
codingMohan
Рет қаралды 1,2 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 873 М.
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 51 МЛН
Random Emoji Beatbox Challenge #beatbox #tiktok
00:47
BeatboxJCOP
Рет қаралды 64 МЛН
A Deep Understanding of Dynamic Programming [Intro / Overview]
29:03
The hidden beauty of the A* algorithm
19:22
Polylog
Рет қаралды 891 М.
Programming Languages Tier List 2024
16:18
Neal Wang
Рет қаралды 9 М.
3112. Minimum Time to Visit Disappearing Nodes | Dijkstras |  Graph
9:03
Leetcode Weekly Contest 334
36:21
Balakrishnan V
Рет қаралды 172
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Why MOST Developer Portfolios are Worthless
12:50
Travis Media
Рет қаралды 13 М.
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 873 М.