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…