Why we are not checking is there a better other option ro reach a cell or not. Here we are just use a visited set, buy usually im dijakastra we will compare if crntTime
Nope, coz here the result may differ by value of 1 of you just push without calculating based on even odd diff. That I had explained in the video. That calculation of even odd diff is the only difference. Rest everything is same.
Leetcode is throwing hard level question frequently
Your explanation is always best :)
Yeah, Leetcode is getting tougher!
As do the interviews :)
best explanation of solution
Thanks! :)
please increase the font size when you are showing the code or the problem. It will help a lot for mobile users. Hope so you see this comment!
yep.
i will try
Thank you sir
welcome :)
Why we are not checking is there a better other option ro reach a cell or not.
Here we are just use a visited set, buy usually im dijakastra we will compare
if crntTime
class Solution:
def minimumTime(self, grid: List[List[int]]) -> int:
rows=len(grid)
cols=len(grid[0])
time=[[float('inf')]*cols for _ in range(rows)]
heap=[(grid[0][0],0,0)]
direc=[(0,1),(0,-1),(-1,0),(1,0)]
time[0][0]=grid[0][0]
if grid[0][1] > 1 and grid[1][0] > 1:
return -1
def isValid(i,j):
return 0
Nope,
coz here the result may differ by value of 1 of you just push without calculating based on even odd diff. That I had explained in the video.
That calculation of even odd diff is the only difference. Rest everything is same.
Thankyou, sir
welcome :)
nice
welcome :)
Thankyou sir
welcome :)