Skip to content

Tag Archives: Java-HashMap

Given a string, the task is to write Java program to print all the duplicate characters with their frequency Example:  Input: str = “geeksforgeeks” Output:… Read More
Given an array arr[] of N integers, the task is to replace each element of Array with their rank in array. The rank of an… Read More
HashMap is a class that implements the Map interface of Java Collections Framework. The most important feature of a HashMap is that it has a… Read More
Given a valid parenthesis string S, the task is to find the weight of parenthesis based on the following conditions: Weight of “( )” is… Read More
Given an array arr[] of N integers, the task is to find the maximum absolute difference between distinct elements of the array.Examples:  Input: arr[] =… Read More
Given an array arr[] containing repetitive prime and nonprime numbers, the task is to find the prime numbers occurring only once. Examples:  Input: arr[] =… Read More
HashMap is a part of Java’s collection since Java 1.2. It provides the basic implementation of the Map interface of Java. It stores the data… Read More
Given two arrays arr1[] and arr2[] consisting of strings, the task is to print the count of anagrams of every string in arr2[] that are… Read More
Given a string str and an integer K, the task is to find the K-th most frequent character in the string. If there are multiple… Read More
Given a N-ary Tree and Q queries where each query contains a node of the N-ary tree, the task is to count the number of… Read More
Given two arrays A[] and B[] containing N elements, the task is to find, for every element in the array B[], the element which is… Read More
Given an array arr, the task is to find the minimum distance between any two same elements in the array. If no such element is… Read More
Given a string array item[] and an integer array price[] where price[i] is the price of the item[i] when purchased from the ith shop. The… Read More
The computeIfPresent(Key, BiFunction) method of HashMap class which allows you to compute value of a mapping for specified key if key is already associated with… Read More
The replaceAll(BiFunction) method of HashMap class replaces each value with the result of applying the given function(performs a certain operation) on the corresponding value. This… Read More