Given a linked list, and a product K. The task is to check if there exist two numbers in the linked list whose product is equal to the given number K. If there exist two numbers, print them. If there are multiple answers, print any of them....
Given a NxM matrix and a sum S. The task is to check if a pair with given Sum exists in the matrix or not....
Given an array where every element occurs ‘a’ times, except one element which occurs b (a>b) times. Find the element that occurs b times....
Given two arrays arr[] and brr[] of length N, the task is to find the minimum number of swaps of the same indexed elements required such an element occurs at least half of the indices in the array arr[], i.e. Majority element. If it is not possible to obtain such an arrangement, then print “-1”....
A HashSet is an unordered collection of the unique elements. It is found in System.Collections.Generic namespace. It is used in a situation where we want to prevent duplicates from being inserted in the collection. As far as performance is concerned, it is better in comparison to the list. HashSet.IntersectWith(IEnumerable) Method is used to modify the current HashSet object to contain only elements that are present in that object and in the specified collection....
Given two arrays A[] and B[] of N unique elements, the task is to find the maximum number of matched elements from the two given arrays....
The java.util.WeakHashMap.get() method of WeakHashMap class is used to retrieve or fetch the value mapped by a particular key mentioned in the parameter. It returns NULL when the map contains no such mapping for the key....
Given an array arr[] consisting of N integers, the task is to find the minimum cost to sort the given array arr[] in ascending order by swapping any pair of elements (X, Y) such that the cost of swapping is (X + Y)....
Max count of N using digits of M such that 2 and 5, and, 6 and 9 can be treated as same respectively
Given an integer N, and the string integer M, the task is to find the total count to make N by using the digits of string M. Also, digit 2 can be treated as digit 5, and digit 6 can be treated as digit 9 and vice versa and each digit from the string M can be used at most once....
Given an array arr of natural numbers up to n, find the maximum size for which array arr can be divided into two equal-sized arrays, such that the first array contains all same elements while the second array contains all distinct elements.Examples:...
Java Program to check whether two given strings are anagrams of each other or not using HashMap....
Given an array arr[] of size N, the task is to print the minimum count of equal length subsets the array can be partitioned into such that each subset contains only a single distinct element...