Description:

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water.

For ...

Posted on

Description:

Return the root node of a binary search tree (BST) that matches the given preorder traversal.

Binary Search Tree (BST):

BSTs are tree based ordered data sctructures. As name suggests, every non-leaf node has only two (Binary) children. Every left child is less than the parent and every right child ...

Posted on
       Input: mat = [[0,0,0,1],[0,0,1,1],[0,1,1,1]]
       Output: 1

Description:

A binary matrix means that all elements are 0 or 1. For each individual row of the matrix, this row is sorted in non-decreasing order.

Given a row-sorted binary matrix binaryMatrix, return leftmost column ...

Posted on

Here we try to solve the valid path problem (#1391) given in leetcode.

There is matrix called grid is given as input. Its values are ranging from 1 to 6. Each of these numbers represent starting and eding directions of the street present in that specific cell of the grid.

  • 1 ...
Posted on

Description:

You have a grid of size n x 3 and you want to paint each cell of the grid with exactly one of the three colours: RedYellow or Green while making sure that no two adjacent cells have the same colour (i.e no two cells that share ...

Posted on