Given two permutations P1 and P2 of numbers from 1 to N, the task is to find the maximum count of corresponding same elements in… Read More
Category Archives: Java Programs
Given n strings that are permutations of each other. We need to make all strings same with an operation that takes front character of any… Read More
Given an array of n elements. Our task is to write a program to rearrange the array such that elements at even positions are greater… Read More
Given a square matrix mat[][] of dimension N and an integer K, the task is to rotate the matrix by 90 degrees K times without… Read More
Given a linked list and a number n. Find the sum of the last n nodes of the linked list.Constraints: 0 <= n <= number… Read More
Given two strings s1 and s2, find if s1 is a substring of s2. If yes, return the index of the first occurrence, else return… Read More
Given an array of positive integers. We are required to write a program to print the minimum product of any two numbers of the given… Read More
Introduction to Identity Matrix : The dictionary definition of an Identity Matrix is a square matrix in which all the elements of the principal or… Read More
Given a linked list containing n nodes. The problem is to insert a new node with data x at the middle of the list. If… Read More
Given an array a, we have to find the minimum product possible with the subset of elements present in the array. The minimum product can… Read More
Given a singly linked list, find middle of the linked list and set middle node of the linked list at beginning of the linked list. Examples:… Read More
Given two sorted arrays of distinct elements, we need to print those elements from both arrays that are not common. The output should be printed… Read More
Given a sorted array of distinct positive integers, print all triplets that form AP (or Arithmetic Progression)Examples :  Input : arr[] = { 2, 6,… Read More
Given a singly linked list and an integer K, the task is to rotate the linked list clockwise to the right by K places.Examples: Input:… Read More
Given an array arr[] consisting of N positive integers, the task is to rotate the digits of array elements in an anti-clockwise direction such that… Read More