Given a non-empty string check if it can be constructed by taking a sub-string of it and appending multiple copies of the sub-string together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000.
Input: "abab" Output: True ...
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 ...
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.
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: Red, Yellow or Green while making sure that no two adjacent cells have the same colour (i.e no two cells that share ...
Return the root node of a binary search tree (BST) that matches the given
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 ...
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.
Input: [1,1,2,3,3,4,4,8,8] Output: 2
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 ...
Input: mat = [[0,0,0,1],[0,0,1,1],[0,1,1,1]] Output: 1
A binary matrix means that all elements are
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 ...