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:

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:

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

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

Description:

You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.

 

Example 1:

Input: [1,1,2,3,3,4,4,8,8]
Output: 2

Example 2:

Input ...
Posted on

Description:

Given the string croakOfFrogs, which represents a combination of the string "croak" from different frogs, that is, multiple frogs can croak at the same time, so multiple “croak” are mixed. Return the minimum number of different frogs to finish all the croak in the given string.

A valid ...

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