The Matrix showed us a traditional perspective of computation theory, which is a hierarchical world and ruled by concrete mapping. Everything have some purpose and it must be mapped to something, even THE ONE. And almost 14 years passed since the fir…
March 16, 2016 Problem statement:Given a 2D array (matrix) named M, print all items of M in a spiral order, clockwise.For example: M = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 The clockwise spiral pr…
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is the kth smallest element in the sorted order, not the kth distinct element. Example: matrix = [ [ 1, 5…
Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside of the boundary (i.e. wrap-around is not allowed). E…
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted in ascending from left to right. Integers in each column are sorted in ascending from top to bottom.…
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted from left to right. The first integer of each row is greater than the last integer of the previous ro…