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

Leetcode & Messages quotes from Estate developer
Download Telegram
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
def raqamlar_yigindisi(n):
if n < 10: #
return n
else:
return n % 10 + raqamlar_yigindisi(n // 10)
Berilgan N natural sonning raqamlari yig'indisini rekursiv funksiya yordamida hisoblang.
simple logic
Hehe
Some one wait today
Contests
Leetcode contest
Hehe
This media is not supported in your browser
VIEW IN TELEGRAM
๐Ÿ—ฟ
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ‘4
whats goin on ๐Ÿ—ฟ
Please open Telegram to view this post
VIEW IN TELEGRAM
๐Ÿ”ฅ2
happy new year guys
โค3๐Ÿ‘2
we back next month ready for next month ) with gifts )
๐Ÿ”ฅ2