0% found this document useful (0 votes)
22 views4 pages

Assignment 2D Array

Uploaded by

717821f159
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

Assignment 2D Array

Uploaded by

717821f159
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Q1.

Spiral Matrix II Medium


Given a positive integer n, generate an n x n matrix filled
with elements from 1 to n2 in spiral order.
Practice

Q2. Richest Customer Wealth Easy

You are given an m x n integer grid accounts where


accounts[i][j] is the amount of money the i​​th​​customer
has in the j​​th​​bank. Return the wealth that the richest
customer has.

A customer's wealth is the amount of money they have in


all their bank accounts. The richest customer is the
customer that has the maximum wealth

Practice

Q3. Toeplitz Matrix Easy


Given an m x n matrix, return true if the matrix is Toeplitz.
Otherwise, return false.

A matrix is Toeplitz if every diagonal from top-left to


bottom-right has the same elements.

Practice

01
Q4. Matrix Diagonal Sum Easy
Given a square matrix mat, return the sum of the matrix
diagonals.

Only include the sum of all the elements on the primary


diagonal and all the elements on the secondary diagonal
that are not part of the primary diagonal.
Practice

Q5. Count Negative Numbers in a Sorted Matrix Easy


Given a m x n matrix grid which is sorted in non-increasing
order both row-wise and column-wise, return the number of
negative numbers in grid.
Practice

Q6. Transpose Matrix Easy


Given a 2D integer array matrix, return the transpose of
matrix.

The transpose of a matrix is the matrix flipped over its main


diagonal, switching the matrix's row and column indices.

Practice

02
Q7. Set Matrix Zeroes Medium
Given an m x n integer matrix matrix, if an element is 0,
set its entire row and column to 0's.

Practice

Q8. Kth Smallest Element in a Sorted Matrix Medium

Given an n x n matrix where each of the rows and columns


is sorted in ascending order, return the kth smallest
element in the matrix.

Note that it is the kth smallest element in the sorted


order, not the kth distinct element.

You must find a solution with a memory complexity


better than O(n2).

Practice

03

You might also like