Skip to content

Category Archives: Java Programs

Given a matrix of N*M order. Find the shortest distance from a source cell to a destination cell, traversing through limited cells only. Also you… Read More
Given a square matrix, the task is that we turn it by 180 degrees in an anti-clockwise direction without using any extra space.  Examples : … Read More
The task at hand involves manipulating a string S of length N, given as input. The string is subjected to a series of B swaps,… Read More
Given a singly linked list containing n nodes. The problem is to sort the list using the recursive selection sort technique. The approach should be… Read More
Given an array arr[] and an integer k, we need to print k maximum elements of given array. The elements should printed in the order… Read More
Given a linked list, the task is to make a function which checks whether the length of the linked list is even or odd. Examples: … Read More
Given a 2D array, print it in reverse spiral form. We have already discussed Print a given matrix in spiral form. This article discusses how… Read More
Given a square matrix and the task is to check the matrix is in upper triangular form or not. A square matrix is called upper… Read More
Given an array arr[] of size N, the task is to check if it is possible to convert all of the array elements to a… Read More
Given a linked list of 0s, 1s and 2s, sort it.Examples: Input: 2->1->2->1->1->2->0->1->0 Output: 0->0->1->1->1->1->2->2->2 The sorted Array is 0, 0, 1, 1, 1, 1,… Read More
Given an array arr[] consisting of N integers, the task is to sort the array in non-increasing order by minimum number of anti-clockwise rotations. If… Read More
Given a permutation arrays A[] consisting of N numbers in range [1, N], the task is to left rotate all the even numbers and right… Read More
Given a large positive number as string, count all rotations of the given number which are divisible by 8. Examples:  Input: 8 Output: 1 Input:… Read More
A matrix is a two-dimensional data object having m rows and n columns, therefore a total of m*n values. If most of the values of… Read More