Number of Enclaves - Leetcode 1020 - Python

  Рет қаралды 7,258

NeetCodeIO

NeetCodeIO

Күн бұрын

🚀 neetcode.io/ - A better way to prepare for Coding Interviews
Solving leetcode 1020 - Number of Enclaves, today's daily leetcode problem on April 6th.
🥷 Discord: / discord
🐦 Twitter: / neetcode1
🐮 Support the channel: / neetcode
⭐ BLIND-75 PLAYLIST: • Two Sum - Leetcode 1 -...
💡 DYNAMIC PROGRAMMING PLAYLIST: • House Robber - Leetco...
Problem Link: leetcode.com/problems/number-...
0:00 - Read the problem
0:30 - Drawing Explanation
5:05 - Coding Explanation
leetcode 1020
#neetcode #leetcode #python

Пікірлер: 25
@lessw2020
@lessw2020 Жыл бұрын
Great video as usual. One comment, your code font size is tiny in this one vs usual ones.
@zagenX
@zagenX Жыл бұрын
Thanks! help to see how own solution can be improved :)
@krateskim4169
@krateskim4169 Жыл бұрын
Thank you so much
@moonlight-td8ed
@moonlight-td8ed 28 күн бұрын
did my own, by watching your video on surrounded region(dfs) thank you
@vishnuvardhan2687
@vishnuvardhan2687 Жыл бұрын
He is a king 👑👑👑 of coding
@nikhilgoyal007
@nikhilgoyal007 Жыл бұрын
line #12 -> res = 1 : would this not set res = 1 again for each dfs call (instead of adding to the initial 1)
@isma5627
@isma5627 Жыл бұрын
what a beutiful solution!
@arkhopravosarkar494
@arkhopravosarkar494 Жыл бұрын
Thankyou❤
@mrmcpherson2722
@mrmcpherson2722 Жыл бұрын
The notification I wanted to see
@roach5429
@roach5429 Жыл бұрын
I dont get how this approach work for example 2. we have 4 lands ans 2 lands are on border so shouldn't this code return 2 instead of 0?
@adityarawat3670
@adityarawat3670 Жыл бұрын
In case 2 we have 4 total land and 4 border land so land-borderland will give zero
@raginibhayana8305
@raginibhayana8305 Жыл бұрын
i am trying to solve this question using yesterdays technique in which i am calculating the number of land not touching the water. can you please help me with that?
@arjunsharma9676
@arjunsharma9676 Жыл бұрын
Here is my solution - class Solution { public int numEnclaves(int[][] grid) { int count=0; int m= grid.length; int n=grid[0].length; for(int i=0;i
@mohammedajmal4264
@mohammedajmal4264 Жыл бұрын
we can use yesterday's technique but in yesterday's problem we were counting the no.of areas containing and today we have to count the cells in that particular area
@acceleratorlevel645
@acceleratorlevel645 Жыл бұрын
we surely can use yesterday's approach to solve this as well, just need to make a few changes in the dfs
@raginibhayana8305
@raginibhayana8305 Жыл бұрын
Yup, I have solved it. I attached my solution link but I think links are blocked on comments.
@mohammedajmal4264
@mohammedajmal4264 Жыл бұрын
@@raginibhayana8305 nice 👌
@akshadabhandari
@akshadabhandari Жыл бұрын
I am failing test cases like even if grid[r][c] == 1: its going in the if condition and returning 0
@DeathSugar
@DeathSugar Жыл бұрын
lol, every time I upload my solution in rust and see something over 1ms feels sus. And than I see python solutions run at almost 1s
@shubhampathak7926
@shubhampathak7926 Жыл бұрын
Can you put the difficulty level of problems on thumbnail?
@cc-to2jn
@cc-to2jn 9 ай бұрын
Heres a solution following his usual pattern: count=0 visited=set() def bfs(i,j): nonlocal count if (i
@vishnuvardhan2687
@vishnuvardhan2687 Жыл бұрын
Aliens 👽👽 attendance taken here
@harshitpant07
@harshitpant07 9 ай бұрын
import sys sys.setrecursionlimit(1000000000) from typing import List class Solution: def numberOfEnclaves(self, grid: List[List[int]]) -> int: # code here def dfs(i, j): grid[i][j] = 0 for x, y in (i - 1, j), (i + 1, j), (i, j - 1), (i, j + 1): if 0
@VladiqLot
@VladiqLot Жыл бұрын
Python are beautiful!
Number of Zero-Filled Subarrays - Leetcode 2348 - Python
10:55
Whiteboard Coding Interviews: 6 Steps to Solve Any Problem
15:18
Fullstack Academy
Рет қаралды 362 М.
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 23 МЛН
🤔Какой Орган самый длинный ? #shorts
00:42
路飞被小孩吓到了#海贼王#路飞
00:41
路飞与唐舞桐
Рет қаралды 78 МЛН
Самый Молодой Актёр Без Оскара 😂
00:13
Глеб Рандалайнен
Рет қаралды 7 МЛН
My 2 Year Journey of Learning C, in 9 minutes
8:42
VoxelRifts
Рет қаралды 574 М.
Big-O Notation - For Coding Interviews
20:38
NeetCode
Рет қаралды 432 М.
69. Sqrt(x) | Leetcode | Python
5:03
Abdullah Arshed
Рет қаралды 344
11 Tips And Tricks To Write Better Python Code
11:00
Patrick Loeber
Рет қаралды 606 М.
25 Nooby Pandas Coding Mistakes You Should NEVER make.
11:30
Rob Mulla
Рет қаралды 263 М.
Largest Color Value in a Directed Graph - Leetcode 1857 - Python
22:11
I gave 127 interviews. Top 5 Algorithms they asked me.
8:36
Sahil & Sarra
Рет қаралды 624 М.
The Algorithm Behind Spell Checkers
13:02
b001
Рет қаралды 408 М.
Building an entity extraction model using BERT
1:09:27
Abhishek Thakur
Рет қаралды 68 М.
New model rc bird unboxing and testing
00:10
Ruhul Shorts
Рет қаралды 23 МЛН