Русские видео

Сейчас в тренде

Иностранные видео


Скачать с ютуб Find the number of islands | GeeksForGeeks | Problem of the Day в хорошем качестве

Find the number of islands | GeeksForGeeks | Problem of the Day 2 недели назад


Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса savevideohd.ru



Find the number of islands | GeeksForGeeks | Problem of the Day

Given a grid of size n*m (n is the number of rows and m is the number of columns in the grid) consisting of '0's (Water) and '1's(Land). Find the number of islands. Note: An island is either surrounded by water or the boundary of a grid and is formed by connecting adjacent lands horizontally or vertically or diagonally i.e., in all 8 directions. Examples: Input: grid = [[0,1],[1,0],[1,1],[1,0]] Output: 1 Explanation: The grid is- 0 1 1 0 1 1 1 0 All lands are connected. Input: grid = [[0,1,1,1,0,0,0],[0,0,1,1,0,1,0]] Output: 2 Expanation: The grid is- 0 1 1 1 0 0 0 0 0 1 1 0 2 0 There are two islands in the grid. One island is marked by '1' and the other by '2'. Expected Time Complexity: O(n*m) Expected Space Complexity: O(n*m) #geeksforgeeks #problemoftheday #education #computerscience #coding #array #sorting #sorts #sort #datastructure #algorithmicproblemsolving #algorithms #algorithm #dynamicprogramming #dp #potd #gfg #binarytree #binarysearchtree #bst #string #dictionary #python #stack #queue #python #c++ #interview Table of Contents 0:00 Problem Statement 1:03 Solution 3:24 Pseudo Code 10:07 Code - Python 11:17 Code - C++

Comments