Weekly Contest 422 All Solutions |

  Рет қаралды 1,051

Arnab Bhadra

Arnab Bhadra

Күн бұрын

Пікірлер: 10
@madhurya6417
@madhurya6417 2 ай бұрын
Thank you sir.. They are working
@ArnabBhadra02
@ArnabBhadra02 2 ай бұрын
Soln: import heapq class Solution: def minTimeToReach(self, move_time): rows = len(move_time) cols = len(move_time[0]) distances = [[float('inf')] * cols for _ in range(rows)] priority_queue = [] heapq.heappush(priority_queue, (0, 0, 0)) distances[0][0] = 0 directions = [(-1, 0), (0, 1), (1, 0), (0, -1)] while priority_queue: curr_time, curr_row, curr_col = heapq.heappop(priority_queue) if curr_time > distances[curr_row][curr_col]: continue for dr, dc in directions: new_row, new_col = curr_row + dr, curr_col + dc if 0
@ArnabBhadra02
@ArnabBhadra02 2 ай бұрын
Soln1: class Solution: def isBalanced(self, num: str) -> bool: sum1 = 0 sum2 = 0 for i in range(len(num)): c = int(num[i]) if i % 2 == 0: sum1 += c else: sum2 += c return sum1 == sum2
@ArnabBhadra02
@ArnabBhadra02 2 ай бұрын
Son3: from typing import List import heapq class Solution: def minTimeToReach(self, moveTime: List[List[int]]) -> int: rows, cols = len(moveTime), len(moveTime[0]) min_time = [[[float('inf')] * 2 for _ in range(cols)] for _ in range(rows)] min_time[0][0][0] = 0 priority_queue = [(0, 0, 0, 0)] directions = [(0, 1), (1, 0), (0, -1), (-1, 0)] while priority_queue: current_time, row, col, parity = heapq.heappop(priority_queue) if current_time > min_time[row][col][parity]: continue for dr, dc in directions: new_row, new_col = row + dr, col + dc if 0
@nottyarmy
@nottyarmy 2 ай бұрын
Sir kindly solve it in C++
@ArnabBhadra02
@ArnabBhadra02 2 ай бұрын
try to convert into your preferred lang
@SRIHARSHAVARTHMIT
@SRIHARSHAVARTHMIT 2 ай бұрын
pls give sol2 and sol 3 is not working
@ArnabBhadra02
@ArnabBhadra02 2 ай бұрын
what error u are getting?
@Kritansh_Tank
@Kritansh_Tank 2 ай бұрын
In my its working, the code's are in Python
LeetCode is a JOKE with This ONE WEIRD TRICK
4:54
AlgoMonster
Рет қаралды 97 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
The evil clown plays a prank on the angel
00:39
超人夫妇
Рет қаралды 53 МЛН
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 342 М.
Minimum Array End - Leetcode 3133 - Python
23:22
NeetCodeIO
Рет қаралды 10 М.
C++ Super Optimization: 1000X Faster
15:33
Dave's Garage
Рет қаралды 333 М.
The purest coding style, where bugs are near impossible
10:25
Coderized
Рет қаралды 1 МЛН
Предел развития НЕЙРОСЕТЕЙ
18:53
Onigiri
Рет қаралды 239 М.
Understand Assembly low-level programming in 22 minutes
22:08
Alisa Esage Шевченко
Рет қаралды 7 М.
Quando A Diferença De Altura É Muito Grande 😲😂
00:12
Mari Maria
Рет қаралды 45 МЛН