Find Factorial of Number. ORJava Program to Find Factorial of Number. ORRecursive Program to find Factorial of Number.
A factorial is a function that multiplies a number by every number below it.
Factorial of 5
5! = 5 * 4 * 3 * 2 * 1 = 120.
Factorial...
Home
»
Archives for 2016
Print Matrix Diagonally OR Diagonal order of Matrix.
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 08:50:00
- No comments

Print Matrix Diagonally. ORLoop diagonally through two dimensional array. ORTraverse an array diagonally. ORPrint elements of Matrix in Diagonal order.
Given a Matrix / 2D array, Print all elements of Matrix in Diagonal order.
Lets understand Diagonal...
Find a Saddle point in Matrix
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 13:39:00
- No comments

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....
Print nodes at K distance from Leaf node in Binary tree.
in
Algorithm,
Binary Search Tree,
Binary Tree,
Datastructure,
Interviews
- on 13:15:00
- No comments

Print nodes at K distance from Leaf in binary tree. ORPrint 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...
Print Nodes at K distance from Root in Binary Tree
in
Algorithm,
Binary Search Tree,
Binary Tree,
Datastructure,
Interviews
- on 21:34:00
- No comments

Print nodes at K distance from root in binary tree. ORPrint 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.
...
Rotate matrix by 90 degree
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 21:04:00
- No comments

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...
Rotate Matrix by 90 degrees clockwise Inplace
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 10:47:00
- No comments

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...
Print Matrix in Spiral order using Recursion.
in
Algorithm,
Datastructure,
Interviews,
Matrix,
Miscellaneous
- on 20:39:00
- No comments

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...
Print Matrix in Spiral form
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 10:44:00
- No comments

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...
Transpose of Matrix Inplace
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 03:46:00
- No comments

Transpose of Matrix In-place
You are given a M * N matrix, find Transpose of Matrix in-place.
Transpose of matrix is obtained by interchanging rows and columns of a matrix that is by changing rows to columns and columns to rows.
Lets understand...
Transpose of Matrix in Java
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 06:34:00
- No comments

Transpose of Matrix in Java
You are given a M * N matrix, find Transpose of Matrix.
Transpose of matrix is obtained by interchanging rows and columns of a matrix that is by changing rows to columns and columns to rows.
Lets understand the...
Implement Queue using One Stack in Java (Recursive Implementation)
in
Algorithm,
Datastructure,
Interviews,
Queue,
Stack
- on 11:41:00
- No comments

Implement Queue using One Stack in Java
You are given a Stack data structure that supports standard push and pop operations.
You need to implement Queue data structure using one Stack instances.
Lets understand the problem statement graphically...
Implement Queue using Stack
in
Algorithm,
Datastructure,
Interviews,
Queue,
Stack
- on 07:01:00
- No comments

Implement Queue using Stack in Java
You are given a Stack data structure that supports standard push and pop operations.
You need to implement Queue data structure using Stack instances.
Lets understand the problem statement graphically and it will...
Download binary file AngularJS + REST service
in
AngularJS,
Miscellaneous,
Web Service
- on 11:35:00
- No comments

Download binary file using AngularJS + REST service
Many
a times we need to download file via POST request, because the request
contains extra parameters to pass and GET request is not suitable.
Download file from server example...
Burning Rope Puzzle - Measure 45 Minutes
in
Interviews,
Puzzle
- on 05:35:00
- No comments

The Burning Rope Puzzle
You have 2 ropes. Each takes exactly 60 minutes to burn. They are made of different material so even though they take the same amount of time to burn, they burn at separate rates.
In addition, each rope burns inconsistently....
Implement Stack using One Queue
in
Algorithm,
Datastructure,
Interviews,
Java,
Queue,
Stack
- on 10:55:00
- No comments

Implement Stack using Single Queue in Java
You are given a Queue data structure that supports standard enQueue and deQueue operations.
You need to implement Stack data structure using Single Queue.
Lets understand the problem statement graphically...
Implement Stack using Queue
in
Algorithm,
Datastructure,
Interviews,
Java,
Queue,
Stack
- on 09:51:00
- No comments

Implement Stack using Queue in Java
You are given a Queue data structure that supports standard enQueue and deQueue operations.
You need to implement Stack data structure using Queue instances.
Lets understand the problem statement graphically...
Find Smallest and Second smallest element in array.
in
Algorithm,
Array,
Datastructure,
Interviews,
Java,
Miscellaneous
- on 20:33:00
- No comments

Find Smallest and Second smallest number in array.
Given a integer array, find smallest and second smallest number in array.
Lets understand the problem statement graphically and it will be more clear,
Find smallest and second smallest element in...
Find Largest and Second Largest number in array
in
Algorithm,
Array,
Datastructure,
Interviews,
Java
- on 19:49:00
- No comments

Find Largest and Second Largest number in array
Given a integer array, find largest and second largest number in array.
Lets understand the problem statement graphically and it will be more clear,
Find the largest and second largest element in...
Find Largest and Second Largest number in array and Find Smallest and Second Smallest number in array
in
Array,
Interviews,
Java,
Miscellaneous
- on 23:05:00
- No comments

Find Largest and Second Largest number in array OR Find the smallest and second smallest element in array.
Given a integer array, find largest and second largest number in array. Lets understand the problem statement graphically and it will be...
Find Largest and Smallest number in Array
in
Array,
Interviews,
Java,
Miscellaneous
- on 04:07:00
- No comments

Find minimum and maximum number in array
Given a integer array, find minimum and maximum number in array.
Lets understand the problem statement graphically and it will be more clear,
Find minimum and maximum element in an array in Java...
Count zeros in a row wise and column wise sorted matrix
in
Algorithm,
Datastructure,
Interviews,
Matrix
- on 12:14:00
- No comments

Count zeros in sorted matrix
Count zeros in a row wise and column wise sorted matrix
Lets understand the problem statement graphically and it will be more clear,
...
Search in a row wise and column wise sorted matrix
in
Interviews,
Java,
Matrix,
Miscellaneous
- on 12:02:00
- No comments

Find number in sorted matrix
Given an n x n matrix, where every row and column is sorted in increasing order. Given a number k, how to decide whether this k is in the matrix. OR
Search number in a row wise and column wise sorted matrix.
Lets...
Find middle element of a linked list
in
Algorithm,
Datastructure,
Interviews,
Linked List
- on 05:33:00
- No comments

Find middle element of a linked list in Java
Given a singly linked list find middle of the linked list.
Find Nth node from last in a linked list
Lets understand the problem statement graphically and it will be more clear,
...
Convert Sorted Linked List to balanced BST
in
Algorithm,
Binary Search Tree,
Binary Tree,
Datastructure,
Interviews,
Linked List
- on 10:03:00
- No comments

Convert Sorted Linked list to balanced Binary Search Tree
Convert sorted list to binary search tree
Lets simplify the question statement, Given a singly Linked List where elements are sorted in ascending order convert it to a height balanced...
Sorted Array to Balanced Binary Search Tree (BST)
in
Binary Search Tree,
Binary Tree,
Interviews
- on 03:47:00
- No comments

Convert Sorted Array to Balanced Binary Search Tree
Given a sorted array, create a Balanced Binary Search Tree using array elements.
A Binary Search Tree is called Balanced if, the height of left subtree and height of right subtree of Root differ...
Union and Intersection of Two Sorted Arrays
in
Array,
Interviews
- on 13:10:00
- No comments

Union and Intersection of Two Sorted arrays
Given two sorted arrays of any length, Find Union and Intersection of given arrays.
Lets understand the problem statement graphically and it will be more clear,
Union and Intersection of two arrays in...
Merge two sorted arrays in Java
in
Array,
Interviews
- on 08:13:00
- No comments

Merge two sorted arrays Java
Merge two sorted arrays in java.
Lets simplify problem statement, given two sorted arrays,
you need to merge it in one array such that merged array should also be sorted.
Lets understand the...
Clone linked list with next and random pointer
in
Algorithm,
Datastructure,
Linked List
- on 05:47:00
- No comments

Clone linked list with next and random pointer
You are given a Doubly Link List with one pointer of each node pointing to the next node just like in a singly link list. The second pointer however can point to any node in the list and not just the...
Clone Linked list in Java
in
Interviews,
Linked List
- on 12:42:00
- No comments

Copy linked list in Java
Given a Linked list, Create a deep copy of Linked list.
Lets understand the problem statement graphically and it will be more clear,
...
Serialize and Deserialize a Binary Tree
in
Binary Tree,
Interviews
- on 10:55:00
- No comments

Serialize and Deserialize a Binary Tree
Design an algorithm to serialize and deserialize given Binary Tree.
Serialization is to store tree in a File/String, so that it can be later restored.
Deserialization is reading tree back from file.
Lets...
Trapping Rain Water between Towers
in
Algorithm,
Datastructure,
Interviews
- on 13:07:00
- No comments

How Much Water Can A Bar Graph Hold
Given an bar graph, encoded as an array of non-negative integers, calculate the units of water that this bar graph can hold.
Let us put in technical terms,
Given n non-negative integers representing an elevation...
How ConcurrentHashMap works and ConcurrentHashMap interview questions.
in
Interviews,
Java
- on 00:52:00
- No comments

ConcurrentHashMap Interview Questions In Java.
Question 1.
What is the need of ConcurrentHashMap when there is HashMap and Hashtable already present?
Performance and Thread safety are 2 parameter on which ConcurrentHashMap is focused.
Imagine...
Java Interface interview questions and answers
in
Interviews,
Java
- on 21:50:00
- No comments

Interface Interview Questions In Java.
Interview questions on Java Interface
Question 1. Super class of all classes is java.lang.Object class, does this applies to Interface as well? What is super class of all Interface in Java?
java.lang.Object...