Remove even frequency characters from the string

Given a string ‘str’, the task is to remove all the characters from the string that have even frequencies. Examples: Input: str = “aabbbddeeecc” Output:… Read More »

Count number of integers less than or equal to N which has exactly 9 divisors

Given a number N(1<=N<=109), the task is to find the total number of integers less than equal to n which have exactly 9 divisors. Examples:… Read More »

First triangular number whose number of divisors exceeds N

Given a number N, find the first triangular number whose number of divisors exceeds N. Triangular numbers are sums of natural numbers, i. e., of… Read More »

Check if the characters of a given string are in alphabetical order

Given a string ‘s’, the task is to find if the characters of the string are in alphabetical order. The string contains only lowercase characters.… Read More »

Sum of nth terms of Modified Fibonacci series made by every pair of two arrays

Given two arrays A and B of same size m. You have to find the sum of nth terms of Fibonacci like series (value of… Read More »

Number of Isosceles triangles in a binary tree

Pre-Requisites: Depth First Search | Parent Array Representation Given a parent array representation of a binary tree, we need to find the number of Isosceles… Read More »

Find Four points such that they form a square whose sides are parallel to x and y axes

Given ‘n’ pair of points, the task is to find four points such that they form a square whose sides are parallel to x and… Read More »

Pair of prime numbers with a given sum and minimum absolute difference

Given an integer ‘sum’ (less than 10^8), the task is to find a pair of prime numbers whose sum is equal to the given ‘sum’… Read More »

Longest subarray with only one value greater than k

Given an array of N numbers, find length of the longest subarray such that K is the second largest element on insertion. Examples: Input: a[]… Read More »

Print values of ‘a’ in equation (a+b) <= n and a+b is divisible by x

Given three numbers b, x, n. The task is to find the values of ‘a’ in equation (a+b) <= n such that a+b is divisible… Read More »

Kth prime number greater than N

Given a number N, the task is to print the Kth prime number greater than N. Note: N and K are so given such that… Read More »

Difference between the largest and the smallest primes in an array

Given an array of integers where all the elements are less than 10^6. The task is to find the difference between the largest and the… Read More »

Number of distinct integers obtained by lcm(X, N)/X

Given a number , find the number of distinct integers obtained by lcm(X, N)/X where X can be any positive number. Examples: Input: N =… Read More »

Numbers in range [L, R] such that the count of their divisors is both even and prime

Given a range [L, R], the task is to find the numbers from the range which have the count of their divisors as even as… Read More »

Number of mismatching bits in the binary representation of two integers

Given two integers(less than 2^31) A and B. The task is to find the number of bits that are different in their binary representation. Examples:… Read More »