Leetcode contest
565 subscribers
176 photos
7 videos
2 files
59 links
Main channel @azamovme

Leetcode & Messages quotes from Estate developer
Download Telegram
😎
Please open Telegram to view this post
VIEW IN TELEGRAM
Tomorrow Contest 😄
Please open Telegram to view this post
VIEW IN TELEGRAM
This media is not supported in your browser
VIEW IN TELEGRAM
An unforgettable moment in history, captured through code and innovation 🥹
Please open Telegram to view this post
VIEW IN TELEGRAM
📱️
wait SoStream 🗿️️️️
or Soplay global 🗿️
Testability is one of the most important advantages of Kotlin Coroutines. It supports operating in virtual time, which lets us write precise, fast, and deterministic tests for cases that are hard to test with other libraries. You can easily check any scenario and assert how much time it would take.
class Solution {
public int minimumTime(int[][] grid) {
if (grid[0][1] > 1 && grid[1][0] > 1) {
return -1;
}
int m = grid.length, n = grid[0].length;
int[][] dist = new int[m][n];
for (var e : dist) {
Arrays.fill(e, 1 << 30);
}
dist[0][0] = 0;
PriorityQueue<int[]> pq = new PriorityQueue<>((a, b) -> a[0] - b[0]);
pq.offer(new int[] {0, 0, 0});
int[] dirs = {-1, 0, 1, 0, -1};
while (true) {
var p = pq.poll();
int i = p[1], j = p[2];
if (i == m - 1 && j == n - 1) {
return p[0];
}
for (int k = 0; k < 4; ++k) {
int x = i + dirs[k], y = j + dirs[k + 1];
if (x >= 0 && x < m && y >= 0 && y < n) {
int nt = p[0] + 1;
if (nt < grid[x][y]) {
nt = grid[x][y] + (grid[x][y] - nt) % 2;
}
if (nt < dist[x][y]) {
dist[x][y] = nt;
pq.offer(new int[] {nt, x, y});
}
}
}
}
}
}


https://leetcode.com/problems/minimum-time-to-visit-a-cell-in-a-grid/?envType=daily-question&envId=2024-11-29
😮
Please open Telegram to view this post
VIEW IN TELEGRAM
🗿️️️️️️
responsive UI in flutter 😮
Please open Telegram to view this post
VIEW IN TELEGRAM