Find the index of a row containing the maximum number of 1’s in a binary matrix
Given a binary M × N row-wise sorted matrix, find a row that contains the maximum number of 1’s in linear time.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a binary M × N row-wise sorted matrix, find a row that contains the maximum number of 1’s in linear time.
Given an M × N matrix, Function to find all common elements present in every row.
Given a directed weighted graph, report a negative-weight cycle in the graph, if any. A negative-weight cycle is a cycle in a graph whose edges sum to a negative value.
Given an M × N matrix where each cell contains a coin of some denomination, collect the maximum value of coins by traversing the grid.
Given an M × N rectangular grid, efficiently count all paths starting from the first cell (0, 0) to the last cell (M-1, N-1). We can either move down or move towards right from a cell.
Given an M × N rectangular grid, print all shortest routes in the grid that start at the first cell (0, 0) and ends at the last cell (M-1, N-1). We can move down or right or diagonally (down-right), but not up or left.
Given an M × N matrix of characters, find the length of the longest path in the matrix starting from a given character. All characters in the longest path should be increasing and consecutive to each other in alphabetical order.
Given an M × N binary matrix, replace all occurrences of 0’s by 1’s, which are completely surrounded by 1’s from all sides (top, left, bottom, right, top-left, top-right, bottom-left, and bottom-right).
Given a binary tree whose nodes are labeled from 0 to N-1, construct an N × N ancestor matrix. An ancestor matrix is a boolean matrix, whose cell (i, j) is true if i is an ancestor of j in the binary tree.
Given an M × N binary matrix, fill it with alternating rectangles of 0 and 1.
Given a square matrix, print the maximum length snake sequence in it. A snake sequence is defined as a sequence of numbers where each new number, which can only be located to the right or down of the current number, is either plus or minus one.
Given a square matrix, rotate the matrix by 180 degrees in a clockwise direction. The transformation should be done in-place in quadratic time.