Print Matrix Diagonally. OR Loop diagonally through two dimensional array. OR Traverse an array diagonally. OR Print elements of Matrix in Diagonal order.

Given a Matrix / 2D array, Print all elements of Matrix in Diagonal order. Lets understand Diagonal order of Matrix graphically.

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 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)

I'm Jayesh Patel, author of "JavaByPatel". I'm not a professional blogger but when time permits, love to share in-depth solutions to common Interview questions asked. Any questions/feedback, Please drop a mail at jayeshmaheshpatel@gmail.com