HTML Entity Parser
Given a string str which has various HTML Entities in it, the task is to replace these entities with their corresponding special character....
read more
Javascript program for counting frequencies of array elements
In this article, we are given an array that may contain duplicate values. We will print all elements and their frequencies if the duplicates exist. We can do this by using two methods:...
read more
Maximum and minimum sum of Bitwise XOR of pairs from an array
Given an array arr[] of size N, the task is to find the maximum and minimum sum of Bitwise XOR of all pairs from an array by splitting the array into N / 2 pairs....
read more
Sum of all minimum frequency elements in Matrix
Given a NxM matrix of integers containing duplicate elements. The task is to find the sum of all minimum occurring elements in the given matrix. That is the sum of all such elements whose frequency is even in the matrix....
read more
Find the smallest after deleting given elements
Given an array of integers, find the smallest number after deleting given elements. In case of repeating elements, we delete one instance (from the original array) for every instance present in the array containing elements to be deleted....
read more
Maximum Balanced Subsequence Score
Given a stock’s prices for the past n days in the array stockPrice. Choose a subsequence (an ordered subset of an array’s elements) of stock prices, called chosenDays, such that the chosen subsequence of stock prices is balanced. The score of the chosen subsequence is the sum of stock prices on the chosen days. Find the maximum possible score that can be obtained by choosing an optimally balanced subsequence. The subsequence of stock prices is balanced if the following condition holds, stockPrice[chosenDays[i]]-stockPrice[chosenDays[i-1]] = chosenDays[i]-chosenDays[i – 1], for i > 0....
read more
Check if encrypted information remains confidential during its Validity Period
Given an array key of size n, instruction count representing the number of keys a hijacker can test per second, during a total validity period which is the average time to find a message key, determine if the encrypted information remains confidential throughout its validity period. Each function will return two items of information as integers:...
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
Maximum frequencies in each M-length subarray
Given an array arr[] consisting of N integers and a positive integer M, the task is to find the maximum frequency for each M-length subarray ( 0 < M ? N)....
read more
Count subarrays having each distinct element occurring at least twice
Given an array arr[] of size N, the task is to count the number of subarrays from the given array, such that each distinct element in these subarray occurs at least twice....
read more
unordered_map operator= in C++ STL
The ‘=’ is an operator in C++ STL which copies (or moves) an unordered_map to another unordered_map and unordered_map::operator= is the corresponding operator function. There are three versions of this function....
read more
Count pairs from two arrays having sum equal to K
Given an integer K and two arrays A1 and A2, the task is to return the total number of pairs (one element from A1 and one element from A2) with a sum equal to K....
read more