Maximum distance between two elements whose absolute difference is K
Given an array arr[] and a number K, the task to find the maximum distance between two elements whose absolute difference is K. If it is not possible to find any maximum distance then print “-1”....
read more
Find maximum element among the elements with minimum frequency in given Array
Given an array arr[] consisting of N integers, the task is to find the maximum element with the minimum frequency....
read more
Count quadruplets with sum K from given array
Given an array arr[] of size N and an integer S, the task is to find the count of quadruplets present in the given array having sum S....
read more
Count of Distinct Substrings occurring consecutively in a given String
Given a string str, the task is to find the number of distinct substrings that are placed consecutively in the given string....
read more
Number of substrings having an equal number of lowercase and uppercase letters
Given string S consists of lowercase and uppercase letters, the task is to find the number of substrings having an equal number of lowercase and uppercase letters....
read more
Count quadruplets(A, B, C, D) till N such that sum of square of A and B is equal to that of C and D
Given a number N, the task is to find the number of quadruples such that a2 + b2 = c2 + d2 where (1 <= a, b, c, d <= N)....
read more
Count subarrays having exactly K elements occurring at least twice
Given an array arr[] consisting of N integers and a positive integer K, the task is to count the number of subarrays having exactly K elements occurring at least twice....
read more
HashTable putIfAbsent() method in Java with Examples
The putIfAbsent(Key, value) method of Hashtable class which allows to map a value to a given key if given key is not associated with a value or mapped to null. A null value is returned if such key-value set is already present in the HashMap....
read more
Sum of nodes within K distance from target
Given a binary tree, a target node and a positive integer K on it,  the task is to find the sum of all nodes within distance K from the target node (including the value of the target node in the sum)....
read more
C# | Check if a Hashtable is equal to another Hashtable
The Hashtable class represents a collection of key-and-value pairs that are organized based on the hash code of the key. The key is used to access the items in the collection....
read more
How to Use Enumeration to Display Elements of Hashtable in Java?
Hashtable class implements a hash table, which maps keys to values. Any non-null object can be used as a key or as a value. To successfully store and retrieve objects from a hashtable, the objects used as keys must implement the hashCode method and the equals method....
read more
Hashtable toString() Method in Java
The toString() method in the Hashtable class in Java returns a string representation of the key-value mappings contained in the hashtable. The string is in the form of a comma-separated list of key-value pairs enclosed in curly braces....
read more