463. Island Perimeter | No BFS or DFS | With DFS | With BFS

Поделиться
HTML-код
  • Опубликовано: 27 окт 2024

Комментарии • 6

  • @YashJaiswal-lr7vi
    @YashJaiswal-lr7vi 6 месяцев назад

    Great approach🔥. Another approach is we can find number of common sides of cell.
    If there are x cells with 1 and y sides are common.
    Then answer will be
    4*x-2*y
    Because single common side is attached to 2 cells.
    Below is my python code:
    class Solution:
    def islandPerimeter(self, grid: List[List[int]]) -> int:
    common=0
    count=0
    for i in range(len(grid)):
    for j in range(len(grid[0])):
    count+=grid[i][j]
    if(i+1

  • @SandeepT-p3o
    @SandeepT-p3o 6 месяцев назад +3

    Hey bro! Start making videos of Codeforces Contests alsoo...

  • @rahulsihara8946
    @rahulsihara8946 6 месяцев назад

    keep up the good work

  • @yashwanthsai7808
    @yashwanthsai7808 6 месяцев назад

    my solution : class Solution {
    public:
    int islandPerimeter(vector& grid) {
    int n = grid.size();
    int sum= 0 ;
    int temp =0;
    for(int i=0;i0 && grid[i-1][j]==1)
    temp-=1;
    if(i

  • @mainakchanda7918
    @mainakchanda7918 6 месяцев назад +1

    Solve this
    verifying an alien dictionary leedcode problem

  • @harshal8781
    @harshal8781 6 месяцев назад

    camera kaha gya aaj?😅