Difference Between Ones and Zeros in Row and Column Solution In C++/Python/java/JS Problem Description You are given a 0-indexed m x n binary matrix grid. A 0-indexed m x n difference matrix diff is created with the following procedure: Let the number of ones in the ith row be onesRow_i. Let the number of ones in the jth column be onesCol_
Lucky Numbers in a Matrix Problem Statement Given an m x n matrix of distinct numbers, return all lucky numbers in the matrix in any order. A lucky number is an element of the matrix such that it is the minimum element in its row and maximum in its column. Examples: Input: matrix = [[3,7,
Richest Customer Wealth Problem Statement 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
Uber Uber OA-15 2023 Problem Description Lazy Alex is playing with the 'Tower of Swapol' game, where there are n towers. Some of these towers contain rings, and the sum of all rings across the towers is exactly n. The goal is to make every tower contain exactly one ring. In a
Row with Maximum ones Problem Statement Given a m x n binary matrix mat, find the 0-indexed position of the row that contains the maximum count of ones, and the number of ones in that row. In case there are multiple rows that have the maximum count of ones, the row with the smallest
Rotate Image Problem Description If you are given an n x n 2D matrix representing an image, rotate it by 90 degrees (clockwise). You have to rotate the image in place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
Transpose Matrix Solution In C++/Python/java/JS 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. Examples : Input: matrix = [[1,2,3],[4,5,6],[7,8,9]] Output: [[1,4,7],[2,
Set Matrix Zeroes Problem Statement Given an m x n integer matrix mat, if an element is 0, set its entire row and column to 0's. You must do it in place. Examples Input: matrix = [[1,1,1],[1,0,1],[1,1,1]] Output: [[1,0,1],[0,0,0]
Modify the Matrix Problem Statement Given a 0-indexed m x n integer matrix matrix, create a new 0-indexed matrix called answer. Make answer equal to matrix, then replace each element with the value -1 with the maximum element in its respective column. Return the matrix answer. Examples: Input: matrix = [[1,2,-1],[4,
Convert 1D Array Into 2D Array Problem Description You are given a 0-indexed 1-dimensional (1D) integer array original, and two integers, m and n. You are tasked with creating a 2-dimensional (2D) array with m rows and n columns using all the elements from the original. The elements from indices 0 to n - 1 (inclusive)