There are many instances when data is stored as key-value pairs. In Java, it can be achieved by “map” which is a collection. Keys usually… Read More

# Tag Archives: Java-HashMap

Geek is a big fan of the Soccer League. Recently he has got a document containing the scores of all the matches played in the… Read More

Given a singly linked list, the task is to Count the pairs of nodes with greater Bitwise AND than Bitwise XOR. Examples: Input: list: 1->4->2->6->3Output:… Read More

Given an array A[] having N positive integers, the task is to perform the following operations and maximize the sum obtained while reducing the array:… Read More

Given a string str of size N containing all possible characters including integers. Print Kth distinct character from the starting of the given string. If… Read More

Given an array arr[]. The task is to minimize the number of removals to make all the elements in arr[] consecutive. Examples Input: arr[] =… Read More

Given an array arr[], the task is to find the number of times the current integer has already occurred during array traversal. Examples: Input: arr[]… Read More

Given an array arr[] of size N, and integer K. The task is to find the longest subsequence with the difference between adjacent elements as… Read More

Given an integer array arr[]. Create a new array which is a rotation of given array and find the maximum Hamming distance between both the… Read More

Given an array A of size N and an integer B, the task is to find all unique quadruplets arranged in the lexicographically increasing order… Read More

Given a Binary Tree consisting of N nodes, the task is to first compress the tree diagonally to get a list of integers and then,… Read More

Here we will be discussing out how we can, we improve the performance while using HashMap in Java, the Importance of the hashCode() contract and… Read More

Given a 2D array arr[][], representing width of bricks of the same height present on a wall, the task is to find the minimum number… Read More

Given an array arr[] consisting of N integers and an integer K, the task is to print all possible unique quadruplets (arr[i], arr[j], arr[k], arr[l])… Read More