Find a Saddle point in Matrix

Find Saddle point in a matrix


Given a matrix of n x n size, Find saddle point of matrix.

What is Saddle point of Matrix?

Element is said to be Saddle point of Matrix if it is both a minimum of its row and a maximum of its column or vice versa.

A matrix may have 1 or 2 saddle points or may not have a saddle point.


Lets understand what will be input and expected output with the help of an example.


Print nodes at K distance from Leaf node in Binary tree.

Print nodes at K distance from Leaf in binary tree. OR
Print all nodes that are at distance k from a leaf node.


Given a Binary Tree, Print all Nodes that are at K distance from leaf node in Binary Tree. Lets understand what will be input and expected output with the help of an example.


If k = 1. It means we need to print all nodes that are at distance 1 from Leaf node.

In Case 2, we have 4 leaf nodes (Node 1, Node 10, Node 5, Node7).
Node at distance K that is Node at distance 1 from leaf Node 1 is Node 2 (Print 2)
Node at distance K that is Node at distance 1 from leaf Node 10 is Node 9 (Print 9)
Node at distance K that is Node at distance 1 from leaf Node 5 is Node 6 (Print 6)
Node at distance K that is Node at distance 1 from leaf Node 7 is Node 6 (6 already printed, ignore)

Print Nodes at K distance from Root in Binary Tree

Print nodes at K distance from root in binary tree. OR
Print nodes at Level K.


Given a Binary Tree, Print all Nodes that are at K distance from root node in Binary Tree. We can also think of this question as Print all nodes that belong to Level K.
 
Lets understand what will be input and expected output with the help of an example.
 

If k = 2. It means we need to print all nodes that are at distance 2 from Root node.
It also means we need to print all nodes at Level 2, because all Nodes of Level 2 will be at same distance from Root Node.

Rotate matrix by 90 degree

Rotate matrix by 90 degree OR
Turn an 2D array by 90 degree OR

Rotate a two dimensional array OR
Given N*M matrix, rotate it by 90 degree to left and right.

Given N*M Matrix, Rotate it by 90 degrees.
 
Lets understand the problem statement graphically and it will be more clear,  




Rotate Matrix by 90 degrees clockwise Inplace

Rotate square matrix by 90 degrees Inplace OR
Turn an 2D array by 90 degree OR

Rotate a two dimensional array OR
Given N*N matrix, rotate it by 90 degree to left and right without extra memory

Rotate square matrix by 90 degrees Inplace. Lets understand the problem statement graphically and it will be more clear,  


Print Matrix in Spiral order using Recursion.

Print Matrix in Spiral order OR
Given m*n matrix(m rows, n columns), print all elements of the matrix in spiral order OR

Print two-dimensional array in spiral order OR
How to print elements of Matrix in Spiral Format?

Given a Matrix(2D array), print it in spiral form. Lets understand the problem statement graphically and it will be more clear,