Category Archives: Java Programs

Given an array of size N, the task is to determine whether its possible to sort the array or not by just one shuffle. In… Read More
Given an array of sorted integers. We need to find the closest value to the given number. Array may contain duplicate values and negative numbers. … Read More
Given an array arr[], count number of pairs arr[i], arr[j] such that arr[i] + arr[j] is maximum and i < j. Example : Input :… Read More
Given an array of N distinct integers. The task is to write a program to check if this array is sorted and rotated counter-clockwise. A… Read More
Given two integer arrays arr1[] and arr2[] sorted in ascending order and an integer k. Find k pairs with smallest sums such that one element… Read More
Given a Linked List of length n and block length k rotate in a circular manner towards right/left each block by a number d. If… Read More
Given an array, right rotate it by k elements.   After K=3 rotation   Examples:   Input: arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9,… Read More
Given a 2-D array of order N x N, print a matrix that is the mirror of the given tree across the diagonal. We need… Read More
Given a linked list, write a function to reverse every k nodes (where k is an input to the function). Examples: Input: 1->2->3->4->5->6->7->8->NULL and k =… Read More
Given an array of n numbers. The problem is to move all the 0’s to the end of the array while maintaining the order of… Read More
Given a string, we need to find the minimum number of rotations required to get the same string. Examples: Input : s = "geeks" Output… Read More
You are given an array A[] of n-elements and a positive integer k. Now you have find the number of pairs Ai, Aj such that… Read More
Given an increasing sequence a[], we need to find the K-th missing contiguous element in the increasing sequence which is not present in the sequence.… Read More
Given a m x n 2D matrix, check if it is a Markov Matrix.Markov Matrix : The matrix in which the sum of each row… Read More
Insert a node x after the nth node from the end in the given singly linked list. It is guaranteed that the list contains the… Read More