Find minimum path sum in a triangle-shaped matrix
Given a right-angled triangle-shaped matrix, find the shortest path sum from the top element to any element in the last row of the matrix.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a right-angled triangle-shaped matrix, find the shortest path sum from the top element to any element in the last row of the matrix.
Given a row-wise and column-wise sorted square matrix and a positive integer k, find the kth smallest number in the matrix.
Given a binary matrix in which the values 0 and 1 correspond to land and water, respectively, and the connected ones form exactly one island, find the perimeter of an island.
Given a rectangular binary matrix, calculate the area of the largest rectangle of 1’s in it. Assume that a rectangle can be formed by swapping any number of columns with each other.
Given an N × N matrix where each cell of the matrix (i, j) indicates the direct flight cost from the city i to city j. Find the minimum cost to reach the destination city N-1 from the source city 0.
Given an M × N matrix of integers whose each cell can contain a negative, zero, or a positive value, determine the minimum number of passes required to convert all negative values in the matrix positive.
Given a non-negative integer n, print the first n rows of Pascal’s triangle.
Given an n × 4 matrix where n is a positive number, find the number of ways to fill the matrix with 1 × 4 tiles.
Given an M × N matrix, count the number of different ways to reach the bottom-right corner of a matrix from its top-left corner with exactly k turn allowed and using only the directions right and down.
In this post, we will see how to sort N^2 numbers in increasing order using an N × N Young tableau in O(N^3) time.
An M × N Young tableau is an M × N matrix such that the entries of each row are sorted from left to right and the entries of each column are sorted from top to bottom. Some entries of a Young tableau may be infinity, which indicates an empty entry.
Given a binary matrix, find the largest square submatrix, which is surrounded by all 1’s.